<!-- 注册页 -->
<!-- 说明--by Liangqingzhu
功能：门户-下单界面
props：{
}
slot:{}
function:{}
-->

<template>
	<div :class="layoutNavClasses">
		<htHeaderTop setHeaderTopWidthNum="1200px"></htHeaderTop>
		<htHeaderNonav title="订单结算" @changeAddress="changeAddress"></htHeaderNonav>
		<div class="htCartWrap">
			<!--购买流程Begin-->
			<htPurchaseProcess class="mt20" :currindex="currindex"></htPurchaseProcess>
			<!--购买流程Begin-->
			<div class="htCartInfoWrap" v-if="!isSubmitSuccess">
				<div style="border: 1px solid #dddddd; padding: 20px 18px">
					<ht-base-form ref="uniInfoData" :model="addFormData" :rules="ruleValidate">
						<!--单位信息Begin 企业用户才展示-->
						<!-- <recommendService /> -->
						<div class="htCartInfoBox" style="border-top: none">
							<div class="htCartInfoBoxTitle title-icon">
								<p>客户信息</p>
								<div @click="open" style="cursor: pointer">
									<Icon type="ios-refresh" size="20" color="#FFFFFF"></Icon
									>切换企业抬头
								</div>
							</div>
							<div class="htCartInfoBoxContent">
								<ht-base-form-item
									prop="purchaserAccount"
									:label-width="labelWidth"
									label="单位全称："
								>
									<ht-base-select
										v-model="addFormData.purchaserAccount"
										style="width: 442px"
										disabled
									>
										<ht-base-option
											v-for="item in selectData.purchaseUnit"
											:value="item.accountId"
											:key="item.accountId"
											@click.native="changePurchaserAccount(item)"
										>
											{{ addFormData.purchaserName }}
										</ht-base-option>
									</ht-base-select>
								</ht-base-form-item>
								<ht-base-form-item
									prop="purContactName"
									:label-width="labelWidth"
									label="下单人："
									:rules="{
										required: true,
										message: '下单人不能为空',
										trigger: 'blur',
									}"
								>
									<ht-base-input
										v-model="addFormData.purContactName"
										placeholder="请输入下单人"
										style="width: 442px"
										disabled
									>
									</ht-base-input>
								</ht-base-form-item>
								<ht-base-form-item
									prop="purContactMobile"
									:label-width="labelWidth"
									label="联系电话："
									:rules="{
										required: true,
										message: '联系电话不能为空',
										trigger: 'blur',
									}"
								>
									<ht-base-input
										v-model="addFormData.purContactMobile"
										placeholder="请输入联系电话"
										maxlength="11"
										style="width: 442px"
										disabled
									>
									</ht-base-input>
								</ht-base-form-item>
							</div>
						</div>
						<!--单位信息End-->
						<!--配送方式Start    -->
						<div class="htCartInfoBox">
							<div class="htCartInfoBoxTitle">
								<p>配送方式</p>
							</div>
							<div class="htCartInfoBoxContent" style="padding-left: 70px">
								<div style="margin: 16px" class="ht-radio">
									<ht-base-radio-group
										size="small"
										v-model="deliveryMethod"
										borderSelect
									>
										<ht-base-radio
											v-for="(item, index) in dictData['peb_delivery_method']"
											:key="index"
											class="htContactSelect"
											:label="item.code"
											>{{ item.descrip }}</ht-base-radio
										>
									</ht-base-radio-group>
								</div>
								<div style="margin: 16px" v-if="deliveryMethod == 0">
									<ht-base-radio-group
										size="small"
										v-model="courierCompany"
										borderSelect
										@on-change="kuaidiChange"
									>
										<ht-base-radio
											class="htContactSelect"
											v-for="(v, i) in kuaidiList"
											:key="i"
											:label="v.code"
										>
											{{ v.descrip }}
										</ht-base-radio>
									</ht-base-radio-group>
								</div>
								<div
									style="margin: 16px; color: #ea2c2c"
									v-if="
										shopSetting &&
										shopSetting.remarkContent &&
										deliveryMethod == 0
									"
									v-html="shopSetting.remarkContent"
								></div>
								<div style="margin: 16px" v-else-if="deliveryMethod == 1">
									<p
										style="
											color: #df0112;
											display: flex;
											justify-content: flex-start;
											align-items: center;
										"
									>
										<img
											src="@/assets/images/orderModule/fas.png"
											style="width: 16px; height: 16px"
											alt=""
										/>
										<span style="margin-left: 8px"
											>您选择了物流，请提交订单后与客服咨询运费事宜，如有其他需要请与客服联系！</span
										>
									</p>
								</div>
								<div style="margin: 16px" v-else-if="deliveryMethod == 2">
									<p>
										您选择了<span style="color: #1e82fa">仓库自提</span
										>，提货时请提供注册的<span style="color: #1e82fa"
											>手机号码</span
										>和<span style="color: #1e82fa">订单编号</span
										>，如有其他需要请与客服联系！
									</p>
								</div>
							</div>
						</div>
						<!-- 配送方式End  -->
						<div class="htCartInfoBox" v-show="deliveryMethod != 2">
							<div class="htCartInfoBoxTitle title-icon">
								<p>
									收货信息<span
										style="margin-left: 10px"
										v-if="receivingAddrInfoShow.length == 0"
										><img
											style="width: 10px; height: 10px"
											src="@/assets/images/shopMall/xing.png"
											alt=""
									/></span>
								</p>
								<div @click="showAddAddrModal" style="cursor: pointer">
									<Icon type="ios-add" size="20" color="#FFFFFF"></Icon
									>新增收货地址
								</div>
							</div>
							<div class="htCartInfoBoxContent" style="padding-left: 70px">
								<ht-base-radio-group
									v-model="addFormData.addressInfo.contactId"
									size="small"
									borderSelect
								>
									<ul class="htAllShoppingAddress clearfix">
										<li
											v-for="(item, index) of receivingAddrInfoShow"
											:key="index"
											style="
												display: flex;
												justify-content: space-between;
												align-items: baseline;
												margin-left: 16px;
											"
											:class="index == 0 ? ' ht-li-address' : ''"
											@click="changeSendAddr($event, item, index, 0)"
											class="clearfix"
										>
											<span
												class="htContactAdress"
												:class="index == 0 ? ' ht-adress' : ''"
											>
												收货地址
												<span></span>
												<img src="@/assets/images/dui.png" alt />
											</span>
											<span class="htContactName">
												{{ item.contactName }}
											</span>
											<span class="htContactMobile">
												{{ item.contactMobile }}
											</span>
											<span class="htContactAddress">
												{{ item.contactProvinceName }}
												{{ item.contactCityName }}
												{{ item.contactCountyName }}
												{{ item.contactTown }}
												{{ item.contactAddress }}
											</span>
											<span
												class="htContactMobiles"
												:title="item.contactManufacturer"
												>{{ item.contactManufacturer }}</span
											>
											<span
												v-if="item.isDefault === '1'"
												class="htContactDefault"
												>默认地址</span
											>
											<span v-else class="htContactDefaultPlace">&nbsp;</span>
											<div class="htContactOp">
												<a
													v-if="item.isDefault === '0'"
													class="htContactSetDefault"
													@click="setDefaulte(item.contactId)"
													>设为默认地址</a
												>
												<a class="htContactSetDefault" v-else></a>
												<a
													class="htContactEdit"
													href="javascript:;"
													@click="showEidtAttrModel(item)"
													>编辑</a
												>
												<a
													class="htContactDelete"
													v-if="item.isDefault === '0'"
													href="javascript:;"
													@click="delAttr(item.contactId)"
													>删除</a
												>
											</div>
										</li>
									</ul>
								</ht-base-radio-group>
								<div v-if="receivingAddrInfoShow.length > 0">
									<div
										class="htAddressToggle"
										style="margin-left: 12px"
										@click="toggle"
										v-if="!visible"
									>
										更多地址
										<ht-base-icon type="LiRa_dad" />
									</div>
									<div
										class="htAddressToggle"
										@click="toggle"
										style="margin-left: 12px"
										v-else
									>
										收起地址
										<ht-base-icon type="LiRa_dau" />
									</div>
								</div>
							</div>
						</div>
						<!-- 发票是否开具 Start-->
						<div class="htCartInfoBox">
							<div class="htCartInfoBoxTitle title-icon">
								<p>发票信息</p>
								<!-- <div @click="openInvoiceModel" style="cursor: pointer">
									<Icon type="ios-add" size="20" color="#FFFFFF"></Icon
									>新增发票信息
								</div> -->
							</div>
							<div
								class="htCartInfoBoxContent"
								style="display: flex; padding-bottom: 20px; padding-left: 70px"
							>
								<ht-base-radio-group style="margin: 0 16px" v-model="needInvoice">
									<ht-base-radio label="1">不开发票</ht-base-radio>
									<ht-base-radio label="2">开具发票</ht-base-radio>
								</ht-base-radio-group>
							</div>
							<div style="margin: 20px 0" v-if="needInvoice == 2">
								<ht-base-form
									:model="invoiceBO"
									label-position="right"
									:label-width="180"
								>
									<ht-base-form-item
										prop="invoiceType"
										label="发票类型："
										label-position="right"
									>
										<ht-base-radio-group
											@on-change="invoiceTitleChange"
											borderSelect
											v-model="invoiceBO.invoiceType"
											size="small"
										>
											<ht-base-radio
												v-for="(item, index) in dictData[
													'fsc_invoice_type'
												]"
												:label="item.code"
												:disabled="
													orgClassId == 1 && item.code == '00'
														? true
														: false
												"
												:key="index"
												>{{ item.title }}
											</ht-base-radio>
										</ht-base-radio-group>
									</ht-base-form-item>
									<!-- <ht-base-form-item prop="invoiceTitle" label="单位类别：">
										<ht-base-radio-group
											@on-change="invoiceTitleChange"
											borderSelect
											v-model="invoiceBO.invoiceTitle"
										>
											<ht-base-radio
												v-for="(item, index) in dictData[
													'fsc_user_invoice_type'
												]"
												:label="item.code"
												:disabled="
													(orgClassId == 2 && index == 1) ||
													(orgClassId == 1 && item.code == '1')
														? true
														: false
												"
												:key="index"
												>{{ item.title }}</ht-base-radio
											>
										</ht-base-radio-group>
									</ht-base-form-item> -->
									<ht-base-form-item label="发票抬头：" prop="invoiceTitle">
										<ht-base-select
											@on-change="changeInvoice"
											v-model="invoiceBO.invoiceSn"
											style="width: 442px"
										>
											<ht-base-option
												v-for="(item, index) in invoiceList"
												:key="index"
												:value="item.invoiceId"
											>
												{{
													item.invoiceTitle + '-' + item.invoiceTypeName
												}}</ht-base-option
											>
										</ht-base-select>
										<!-- <div class="dib" style="margin-left: 16px; cursor: pointer"
											@click="is_invoce_show = !is_invoce_show"
											v-show="!is_invoce_show && needInvoice == 2">
											发票信息
											<ht-base-icon type="LiRa_dad" />
										</div>
										<div class="dib" style="margin-left: 16px; cursor: pointer"
											@click="is_invoce_show = !is_invoce_show"
											v-show="is_invoce_show && needInvoice == 2">
											发票信息
											<ht-base-icon type="LiRa_dau" />
										</div> -->
									</ht-base-form-item>
									<ht-base-form-item
										class="disa"
										label="收票邮箱："
									>
										<!-- <Input
											v-model="detail.receiveEmail"
											style="width: 442px"
											disabled
										/> -->
										<ht-base-select
											v-model="detail.receiveEmail"
											style="width: 442px"
										>
											<ht-base-option
												v-for="(item, index) in receiveEmailListOrder"
												:key="index"
												:value="item.elcInvoiceEmail"
												:label="item.elcInvoiceEmail"
											>
											</ht-base-option>
										</ht-base-select>
										<div class="btn">
											<Button
												type="primary"
												@click="editInfo(true, detail)"
												style="marginright: 10px"
												>编辑</Button
											>
										</div>
									</ht-base-form-item>
								</ht-base-form>
							</div>
							<!-- <div class="invoice-form ht-global-detail" v-show="is_invoce_show && needInvoice == 2"> -->
							<div
								class="invoice-form ht-global-detail"
								v-if="detail && detail.accountId && needInvoice == 2"
							>
								<ht-base-form
									:model="detail"
									label-position="top"
									inline
									class="c-form"
									:rules="detailRule"
									ref="taitouForm"
								>
									<ht-base-form-item
										label="发票抬头："
										prop="invoiceTitle"
										style="width: 100%"
										class="title cc-item"
									>
										<Input v-model="detail.invoiceTitle" :disabled="editBtn" />
									</ht-base-form-item>
									<ht-base-form-item
										v-if="invoiceBO.invoiceType == '01' && expandAllShow"
										label="邮箱地址："
										prop="receiveEmail"
										style="width: 100%"
										class="title cc-item"
									>
										<Input v-model="detail.receiveEmail" :disabled="editBtn" />
									</ht-base-form-item>
									<template
										v-if="invoiceBO.invoiceTitle != PERSONAL && expandAllShow"
									>
										<ht-base-form-item
											label="纳税人识别号："
											prop="taxpayerId"
											style="width: 100%"
											class="title cc-item"
										>
											<Input
												:readonly="orgClassId == 1 || orgClassId == 3"
												v-model="detail.taxpayerId"
												:disabled="editBtn"
											/>
										</ht-base-form-item>
										<ht-base-form-item
											label="开户银行："
											prop="bank"
											style="width: 100%"
											class="title cc-item"
											v-if="invoiceBO.invoiceType == '00'"
										>
											<Input
												:readonly="orgClassId == 1 || orgClassId == 3"
												v-model="detail.bank"
												:disabled="editBtn"
											/>
										</ht-base-form-item>
										<ht-base-form-item
											label="银行账户："
											prop="account"
											style="width: 100%"
											class="title cc-item"
											v-if="invoiceBO.invoiceType == '00'"
										>
											<Input
												:readonly="orgClassId == 1 || orgClassId == 3"
												v-model="detail.account"
												:disabled="editBtn"
											/>
										</ht-base-form-item>
										<ht-base-form-item
											label="注册地址："
											prop="address"
											style="width: 100%"
											class="title cc-item"
											v-if="invoiceBO.invoiceType == '00'"
										>
											<Input
												:readonly="orgClassId == 1 || orgClassId == 3"
												v-model="detail.address"
												:disabled="editBtn"
											/>
										</ht-base-form-item>
										<ht-base-form-item
											label="注册电话："
											prop="phone"
											style="width: 100%"
											class="title cc-item"
											v-if="invoiceBO.invoiceType == '00'"
										>
											<Input
												:readonly="orgClassId == 1 || orgClassId == 3"
												v-model="detail.phone"
												:disabled="editBtn"
											/>
										</ht-base-form-item>
										<!-- <ht-base-form-item label="注册邮箱：" prop="receiveEmail" style="width: 100%"
											class="title cc-item">
											<Input :readonly="orgClassId == 1 || orgClassId == 3"
												v-model="detail.receiveEmail" :disabled="editBtn" />
										</ht-base-form-item> -->
									</template>
									<div
										class="box-twoCard-all"
										style="
											padding: 10px 0;
											font-size: 14px;
											cursor: pointer;
											color: #056de8;
										"
										@click="expandAll"
									>
										<span v-if="expandAllShow">
											收起全部<i
												class="el-icon-d-arrow-right"
												style="transform: rotate(-90deg)"
											></i>
										</span>
										<span v-else>
											展开全部<i
												class="el-icon-d-arrow-right"
												style="transform: rotate(90deg)"
											></i>
										</span>
									</div>
								</ht-base-form>

								<div
									style="
										color: #df0112;
										display: flex;
										justify-content: flex-start;
										align-items: center;
									"
								>
									<img
										src="@/assets/images/orderModule/fas.png"
										style="width: 16px; height: 16px"
										alt=""
									/>
									<span style="margin-left: 8px; color: #056de8">
										由于每月底为财务结账日，当月25-31日提交的订单，发票均次月1日后安排开出。30个工作日内可申请补开发票
									</span>
								</div>
							</div>
						</div>
						<!-- 支付方式 Start-->
						<div class="htCartInfoBox">
							<div class="htCartInfoBoxTitle">
								<p>支付方式</p>
							</div>
							<div class="htCartInfoBoxContent" style="padding-left: 70px">
								<ht-base-radio-group
									v-model="payType"
									size="small"
									borderSelect
									@on-change="payTypeChange"
								>
									<ul
										class="htAllShoppingAddressNew clearfix"
										style="margin-left: 10px"
									>
										<ht-base-radio
											class="htContactSelect"
											:label="item.value"
											v-for="(item, index) in payTypeMapList"
											:key="index"
											:disabled="
												$route.query.activityModel &&
												enumPay[enumPay[Number(item.value)]] != 1
													? true
													: false
											"
											v-if="item.title != '钱包支付'"
										>
											<template v-if="item.value == 1">
												<!-- <small class="hui">惠</small> -->
												{{ item.title }}
											</template>

											<template v-else>
												{{ item.title }}
											</template>
										</ht-base-radio>
									</ul>
								</ht-base-radio-group>
							</div>
							<div class="payType-notice" v-show="payType" style="padding-left: 70px">
								<div v-if="payType == 0" class="common_notice">
									在线支付支持: 微信、支付宝、银联在线支付
								</div>
								<div v-if="payType == 2" class="common_notice">
									<ht-base-radio-group v-model="billingPeriodRule" vertical>
										<span class="titleTip">请选择帐期规则：</span>
										<ht-base-radio
											v-for="(item, index) in periodRules"
											:label="item.value"
											:key="index"
										>
											{{ item.title }}
											{{
												item.value == '一单一议'
													? '（针对特殊订单，对于本次使用账期有商议需求的，买方可申请使用”一单一议“）'
													: ''
											}}
										</ht-base-radio>
									</ht-base-radio-group>
									<div style="margin-top: 10px">
										<ht-base-radio-group v-model="payMod">
											<span class="titleTip">付款方式：</span>
											<ht-base-radio
												v-for="(item, index) in accountPeriodPayTypeMapList"
												:label="item.value"
												:key="index"
											>
												{{ item.title }}
											</ht-base-radio>
										</ht-base-radio-group>
									</div>
								</div>
								<div v-if="payType == 1" class="common_notice">
									<span class="single">
										VIP卡余额：{{
											$accounting.formatMoney(
												openFlagFrom.accountBalance,
												'￥'
											)
										}}
									</span>
								</div>
								<div v-if="payType == 3" class="offline-notice">
									<div class="dtels-left">
										<ht-base-radio-group v-model="payMod">
											<span class="titleTip">领布商城支持线下支付：</span>
											<ht-base-radio
												v-for="(item, index) in payDownTypeMapList"
												:label="item.value"
												:key="index"
												:disabled="
													$route.query.activityModel &&
													enumPay[enumPay[Number(item.value)]] != 1
														? true
														: false
												"
											>
												{{ item.title }}
											</ht-base-radio>
										</ht-base-radio-group>
									</div>
								</div>
							</div>
						</div>
					</ht-base-form>
				</div>
				<div class="d-table">商品清单</div>
				<!--商品清单Begin-->
				<ListTable
					:orderSource="cartObg.selectedOrderSouce"
					:goodsList="goodsList"
					:flag="flag"
					v-bind:detail="fee_detail"
					:priceDis="priceDis"
					:isSelfTi="isSelfTi"
					:activityIds="activityIds"
					:measureNames="measureNames"
					:resonName="resonName"
					:orderQuantitys="orderQuantitys"
					:joinPrices="joinPrices"
					:totoPrice="totoPrice"
					:unitPrice="unitPrice"
					:isSettlement="isSettlement"
					:orderDesc="orderDesc"
					v-bind:shipmentsRemark="shipmentsRemark"
					@sendOrderDesc="receiveFromChild"
				>
				</ListTable>
				<!--商品清单End-->
				<!--订单总金额Begin-->
				<orderTotalMoney
					v-bind:detail="fee_detail"
					:payType="payType"
					:totoPrice="totoPrice"
					:activityIds="activityIds"
				>
				</orderTotalMoney>
				<!--订单总金额End-->
				<!--底部操作Begin-->
				<div v-if="currAdressIndex === '1'" class="htAnOrderFooterOp">
					<div class="inner">
						<div class="btnGroup clearfix">
							<ht-base-button
								type="primary"
								@click="toOpenOrderModal"
								size="large"
								class="btCreateOrder"
								v-preventReClick="1000"
								>提交订单</ht-base-button
							>
							<div v-if="!flag" class="htGoCart" @click="goBack">返回</div>
							<div v-else class="htGoCart" @click="goBackDetail">返回</div>
						</div>
					</div>
				</div>
				<!--底部操作End-->
			</div>
			<orderSuccess
				v-else
				:mergeOrderId="mergeOrderId"
				:failGoodsList="failedCommodityBoList"
				ref="orderSuccess"
			>
			</orderSuccess>
			<div style="height: 10px; width: 100%"></div>
			<br />
			<!-- <recommendService v-if="currindex == 2" /> -->
		</div>
		<ShopFoot></ShopFoot>
		<invoiceInfoAdd ref="invoiceInfoAdd" @addInvoiceSuccess="getInvoiceList" />
		<invoiceInfoEdit ref="invoiceInfoEdit" @editInvoiceSuccess="editInvoiceSuccess" />
		<InvoiceReceAddForm ref="invoiceReceAddForm" @addInvoiceSuccess="getInvoiceAddressList" />
		<InvoiceReceEditForm
			ref="InvoiceReceEditForm"
			@editInvoiceSuccess="getInvoiceAddressList"
		/>

		<!-- 新增收货地址弹窗 -->
		<el-dialog
			title="收货人信息"
			:visible.sync="dialogAddAddress"
			width="50%"
			style="border-radius: 6px"
		>
			<div class="dialogAddAddressForm">
				<el-form
					:model="addAddrData"
					:rules="ruleValidate"
					ref="addAddrForm"
					label-width="100px"
					class="demo-ruleForm"
				>
					<el-form-item label="收货人：" prop="contactName">
						<el-input
							v-model="addAddrData.contactName"
							placeholder="请填写收货人姓名"
						></el-input>
					</el-form-item>
					<el-form-item label="联系电话：" prop="contactMobile">
						<el-input
							v-model="addAddrData.contactMobile"
							placeholder="请填写手机号码"
						></el-input>
					</el-form-item>
					<el-form-item label="所在地区：" prop="location">
						<el-cascader
							placeholder="请选择地址"
							v-model="addAddrData.location"
							:options="options"
							@change="handleChange"
						></el-cascader>
					</el-form-item>
					<el-form-item label="详细地址：" prop="contactAddress">
						<el-input
							v-model="addAddrData.contactAddress"
							placeholder="请填写详细地址"
							name="ADDRESS_LIMIT"
						></el-input>
					</el-form-item>
					<el-form-item label="收货单位：" prop="contactManufacturer">
						<el-input
							v-model="addAddrData.contactManufacturer"
							maxlength="50"
							name="TAITOU_LIMIT"
							placeholder="请填写收货单位"
						></el-input>
					</el-form-item>
					<el-form-item label="邮箱：" prop="contactEmail">
						<el-input
							v-model="addAddrData.contactEmail"
							placeholder="请填写邮箱"
						></el-input>
					</el-form-item>
					<el-form-item label="固定电话：" prop="contactFixPhone">
						<div
							style="display: flex; justify-content: flex-start; align-items: center"
						>
							<el-input
								style="width: 60%"
								v-model.trim="addAddrData.fixPhone"
								placeholder="区号-电话号码"
							></el-input
							>-<el-input
								style="width: 35%"
								v-model.trim="addAddrData.extensionNumber"
								placeholder="分机号"
							></el-input>
						</div>
					</el-form-item>
					<el-form-item prop="isDefault">
						<Checkbox
							v-model="addAddrData.isDefault"
							true-value="1"
							false-value="0"
							style="font-size: 12px"
						>
							设置为默认收货地址 设置后系统将在下单时自动选中该收货地址
						</Checkbox>
					</el-form-item>
				</el-form>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogAddAddress = false">取 消</el-button>
				<el-button type="primary" @click="addAttr" :loading="addLoading"
					>保存并使用</el-button
				>
			</span>
		</el-dialog>

		<!--修改收货人信息模态框-->
		<el-dialog
			title="收货人信息"
			:visible.sync="editAddrModal"
			width="50%"
			style="border-radius: 6px"
		>
			<div class="dialogEidtAddressForm">
				<el-form
					:model="editaddrData"
					:rules="ruleValidate"
					ref="editAddrForm"
					label-width="100px"
					class="demo-ruleForm"
				>
					<el-form-item label="收货人：" prop="contactName">
						<el-input
							v-model="editaddrData.contactName"
							placeholder="请填写收货人姓名"
						></el-input>
					</el-form-item>
					<el-form-item label="联系电话：" prop="contactMobile">
						<el-input
							v-model="editaddrData.contactMobile"
							placeholder="请填写手机号码"
						></el-input>
					</el-form-item>
					<el-form-item label="所在地区：" prop="location">
						<el-cascader
							placeholder="请选择地址"
							v-model="editaddrData.location"
							:options="options"
							@change="handleChange1"
						></el-cascader>
					</el-form-item>
					<el-form-item label="详细地址：" prop="contactAddress">
						<el-input
							v-model="editaddrData.contactAddress"
							placeholder="请填写详细地址"
							name="ADDRESS_LIMIT"
						></el-input>
					</el-form-item>
					<el-form-item label="收货单位：" prop="contactManufacturer">
						<el-input
							v-model="editaddrData.contactManufacturer"
							maxlength="50"
							name="TAITOU_LIMIT"
							placeholder="请填写收货单位"
						></el-input>
					</el-form-item>
					<el-form-item label="邮箱：" prop="contactEmail">
						<el-input
							v-model="editaddrData.contactEmail"
							placeholder="请填写邮箱"
						></el-input>
					</el-form-item>
					<el-form-item label="固定电话：" prop="contactFixPhone">
						<div
							style="display: flex; justify-content: flex-start; align-items: center"
						>
							<el-input
								style="width: 60%"
								v-model.trim="editaddrData.fixPhone"
								placeholder="区号-电话号码"
							></el-input
							>-<el-input
								style="width: 35%"
								v-model.trim="editaddrData.extensionNumber"
								placeholder="分机号"
							></el-input>
						</div>
					</el-form-item>
					<el-form-item prop="isDefault">
						<Checkbox
							v-model="editaddrData.isDefault"
							true-value="1"
							false-value="0"
							style="font-size: 12px"
						>
							设置为默认收货地址 设置后系统将在下单时自动选中该收货地址
						</Checkbox>
					</el-form-item>
				</el-form>
			</div>
			<span slot="footer" class="dialog-footer">
				<el-button @click="editAddrModal = false">取 消</el-button>
				<el-button type="primary" @click="editAttr" :loading="editLoading"
					>保存并使用</el-button
				>
			</span>
		</el-dialog>

		<ht-base-modal v-model="notStockModal" :closable="false" :mask-closable="false">
			<div slot="header">
				<Icon type="ios-close-circle" color="#eda014" :size="24" />
				<div class="stock-title">库存不足提示</div>
			</div>
			<div>
				<p style="font-size: 14px; font-weight: 600; line-height: 30px">
					{{ notStockText }}
				</p>
				<p
					style="font-size: 14px; font-weight: 600; line-height: 30px"
					v-show="orderTotalMoney.skuTypeNum.length != notStockList.length && !disGoOn"
				>
					是否继续下单其他供应商商品？
				</p>
			</div>
			<div slot="footer">
				<Button
					v-preventReClick="2000"
					type="primary"
					size="large"
					@click="createOrder(0)"
					v-show="orderTotalMoney.skuTypeNum.length != notStockList.length && !disGoOn"
				>
					继续
				</Button>
				<Button type="text" size="large" @click="goBack">返回</Button>
			</div>
		</ht-base-modal>
		<BroadsideNavigation />
		<!-- 核对订单信息 Modal -->
		<ht-base-modal
			title="核对订单信息"
			width="1400"
			style="overflow-y: scroll"
			v-model="orderCheckModal"
			class="ht-layout-skyBlue c-model"
		>
			<div class="htCartWrap">
				<ht-base-form label-position="left">
					<ht-base-form-item label="企业抬头：">
						<!-- <span style="color: #056de8">{{ detail.accountName }}</span> -->
						<span style="color: #056de8">{{ addFormData.purchaserName }}</span>
					</ht-base-form-item>
					<ht-base-form-item label="配送方式：">
						<span style="color: #056de8">
							{{
								deliveryMethod == '0'
									? '快递'
									: deliveryMethod == '1'
									? '领布物流'
									: '自提'
							}}&nbsp;&nbsp;&nbsp;{{ companyCName }}
						</span>
					</ht-base-form-item>
					<ht-base-form-item label="收货地址：" v-show="deliveryMethod != 2">
						<span style="color: #056de8">
							{{ addFormData.addressInfo.contactName + '&nbsp;' }}
							{{ addFormData.addressInfo.contactMobile + '&nbsp;' }}
							{{ addFormData.addressInfo.contactProvinceName + '/' }}
							{{ addFormData.addressInfo.contactCityName + '/' }}
							{{ addFormData.addressInfo.contactCountyName }}
							{{
								addFormData.addressInfo.contactAddress ||
								'' + '&nbsp;' + '&nbsp;' + '&nbsp;' + '&nbsp;'
							}}
							{{ addFormData.addressInfo.contactManufacturer + '&nbsp;' }}
						</span>
					</ht-base-form-item>
					<ht-base-form-item
						label="开票信息："
						v-if="needInvoice == 2 && invoice_mes.name && invoice_mes.id"
					>
						{{
							invoice_mes.invoiceTypeName +
							'&nbsp;' +
							'(' +
							invoice_mes.accountName +
							')'
						}}
					</ht-base-form-item>
					<ht-base-form-item
						label="邮箱："
						v-if="needInvoice == 2 && invoice_mes.name && invoice_mes.id"
					>
						{{ detail.receiveEmail }}
					</ht-base-form-item>
					<ht-base-form-item label="支付方式：">{{ p_str }}</ht-base-form-item>
				</ht-base-form>
				<div class="htCartInfoWrap">
					<ListTable
						:orderSource="cartObg.selectedOrderSouce"
						:goodsList="goodsList"
						v-show="orderCheckModal"
						showDetail
						:flag="flag"
						:fee_detail="fee_detail"
						:priceDis="priceDis"
						:isSelfTi="isSelfTi"
						:activityIds="activityIds"
						:measureNames="measureNames"
						:resonName="resonName"
						:orderQuantitys="orderQuantitys"
						:joinPrices="joinPrices"
						:totoPrice="totoPrice"
						:unitPrice="unitPrice"
						:isSettlement="isSettlement"
						:orderDesc="orderDesc"
						v-bind::shipmentsRemark="shipmentsRemark"
						@sendOrderDesc="receiveFromChild"
					>
					</ListTable>
					<!--订单总金额Begin-->
					<orderTotalMoney
						v-bind:detail="fee_detail"
						:payType="payType"
						:totoPrice="totoPrice"
						:activityIds="activityIds"
					>
					</orderTotalMoney>
				</div>
				<div style="width: 100%; height: 70px"></div>
			</div>

			<template #footer>
				<div style="text-align: center">
					<ht-base-button
						type="primary"
						@click="
							() => {
								groupQryStock()
							}
						"
						style="border: 0"
						>确认提交</ht-base-button
					>
					<ht-base-button @click="orderCheckModal = false">返回修改</ht-base-button>
				</div>
			</template>
		</ht-base-modal>
		<!-- 切换组织机构 -->
		<Modal v-model="modal" title="组织机构切换" class="modal" :width="700">
			<RadioGroup
				v-model="selectedOrgId"
				@on-change="changeSeleOrg"
				vertical
				v-if="orgList && orgList.length > 0"
			>
				<!-- <Radio v-for="(item,index) in orgList" :label="item.userId" :key="index" v-if="item.orgFullName != null && item.orgFullName != ''">{{ item.orgFullName }}</Radio> -->
				<Radio v-for="(item, index) in orgList" :label="item.orgId" :key="index"
					>{{ item.orgName }} ({{ item.tradeCapacityStr }})</Radio
				>
			</RadioGroup>
			<div slot="footer" style="text-align: center">
				<Button type="primary" @click="onModal">确定</Button>
				<Button type="primary" @click="modal = false">取消</Button>
			</div>
		</Modal>
	</div>
</template>

<script>
import '@/styles/pages/shopMall/cart/cart.less'
import common from '@/libs/loginToken/common.js'
import htHeaderTop from '@/layouts/basic-layout/header-top'
import htHeaderNonav from '@/layouts/basic-layout/header-nonav'
import htCartTopOpModule from './components/htCartTopOpModule'
import htPurchaseProcess from './components/htPurchaseProcess'
import CascadeOfCity from '@/components/common/cascadeOfCity.vue'
import ListTable from './components/listTable.vue'
import orderTotalMoney from './components/orderTotalMoney.vue'
import InvoiceChoose from './components/InvoiceChoose'
import orderSuccess from './components/orderSuccess'
import ShopFoot from '@/components/shop/shopFoot.vue'
import recommendService from './components/recommendService'
import BroadsideNavigation from '@/pages/shopMall/shopping/components/broadsideNavigation/index.vue'
import { postApi, staticUrl } from '@/api'
import { mapActions, mapGetters, mapState } from 'vuex'
import Validator from '@/libs/util.validators'
import orderMinxin from '@/mixins/orderMinxin'
import InvoiceReceAddForm from '@/components/order/addInvoice'
import invoiceInfoAdd from './invoiceInfoAdd'
import invoiceInfoEdit from './invoiceInfoEdit'
import InvoiceReceEditForm from '@/components/order/InvoiceReceEditForm'

export default {
	mixins: [orderMinxin],
	name: 'placeAnOrder',
	data() {
		// 纳税人识别号效验
		const taxpayerIdVal = (rule, value, callback) => {
			let regexp = /[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}/
			if (value !== '') {
				if (!regexp.test(value)) {
					callback(new Error('请输入正确的纳税人识别号'))
				} else {
					callback()
				}
			} else {
				callback(new Error('请输入纳税人识别号'))
			}
		}
		// 银行卡号效验
		const backNoVal = (rule, value, callback) => {
			let regexp = /^[1-9]\d{9,29}$/
			if (value !== '') {
				if (!regexp.test(value)) {
					callback(new Error('请输入正确的银行账户'))
				} else {
					callback()
				}
			} else {
				callback()
			}
		}
		// 固定电话效验
		const phoneVal = (rule, value, callback) => {
			let regexp = /^(\d{3,4}-)?\d{7,8}$/
			if (value !== '') {
				if (!regexp.test(value)) {
					callback(new Error('请输入正确注册电话'))
				} else {
					callback()
				}
			} else {
				callback()
			}
		}
		return {
			periodRules: [
				{
					value: '一单一议',
					title: '一单一议',
				},
			],
			billingPeriodRule: '',
			PERSONAL: 2, // 发票抬头类型为个人的
			enumPay: {},
			detailRule: {},
			modal: false,
			orgList: [],
			selectedOrg: {}, // 选中的组织机构
			selectedOrgId: '',
			editBtn: true,
			courierCompany: '3',
			isSelfTi: true,
			orderCheckModal: false,
			currindex: '1',
			is_invoce_show: false,
			invoice_id: '',
			needInvoice: '2', // 是否需要开具发票
			invoiceBO: {
				invoiceType: '',
			}, // 发票信息
			deliveryMethod: '0', // 配送方式
			payType: '0',
			labelWidth: 168,
			htPlaceOrderFixed: true,
			currAdressIndex: '1',
			detail: {},
			priceDis: 0,
			addFormData: {
				purchaserAccount: '',
				purchaserName: '',
				payType: '',
				payType1: '',
				giveTime: '',
				remark: '',
				purContactMobile: '',
				contactManufacturer: '',
				purContactName: '',
				addressInfo: {
					contactId: 0,
				},
				accessoryList: [],
			},
			receivingInvoicInfo: [],
			receivingInvoicInfoShow: [],
			accountDetail: {}, // 账户信息
			chooseReceiveInvoic: {
				id: '',
				postAddress: {},
			},
			codeMapping: {
				1: 3,
				2: 2,
				3: 1, // 无协议
			},
			uniInfoRules: [],
			canSubmit: true, // 是否支持下单
			// 静态下拉字典表
			dictData: {
				peb_pay_type: [],
				peb_delivery_method: [], // 配送方式
				fsc_invoice_type: [], // 发票类型
				fsc_user_invoice_type: [], // 发票抬头
			},
			payTypeMapList: [], // 公有支持的支付方式
			payDownTypeMapList: [], // 公有支持的线下
			accountPeriodPayTypeMapList: [], // 公有支持的线下
			payMod: '',
			baseData: {}, // 用户详情
			cartInfo: {}, // 购物车信息
			headTitle: '填写订单详情',
			flow: 1,
			flowData: [
				{
					name: '我的购物车',
					class: 'disabled',
				},
				{
					name: '填写核对订单信息',
					class: 'active',
				},
				{
					name: '提交订单',
					class: '',
				},
			],
			feeFlag: false,
			payInfo: {}, // 支付信息
			payInfo1: {}, // 支付信息
			uploadHeaders: { 'auth-token': util.cookies.get('auth-token') },
			uploadAction: staticUrl(DYC_URL.m_fileGenerationUpload),
			spinShow: false, // 遮罩层
			acctBalance: '',
			shipmentsRemark: '', // 发货地提示
			// 订单总金额
			orderTotalMoney: {
				skuTypeNum: 0, // 货品种类
				saleFeeMoney: '', // 商品总金额
				transFeeMoney: '', // 运费
				totalSaleFeeMoney: '', // 结算总金额（含运费）
			},
			isWuErrModal: false,
			isShowMoreErr: false,
			qryCount: 15,
			isAsking: false,
			timer: '',
			selectData: {
				// 采购单位
				purchaseUnit: [],
				// 支付方式
				paymentMethod: [],
				// 发货时间
				arriveDate: [],
			},
			kuaidiList: [],
			userSupList: [], // 判断商品中是否有个人供应商
			isClicked: false,
			visible: false,
			visibleInnvio: false,
			singleDiscussion: '',
			balanceMoney: '',
			integal1: '', // 第三方电商剩余授信额度
			integal2: '', // 平台协议剩余授信额度
			integal3: '', // 单位协议剩余授信额度
			// 模式是贸易模式的金额
			modePrice: 0,
			// 模式是贸易模式,是平台协议的金额
			platformPrice: 0,
			// 模式是贸易模式,是单位协议的金额
			companyPrice: 0,
			erpCustomerAccountPeriod: {}, // 客户账期信息
			customerDepositBalance: {
				cardNo: null,
			}, // 客户预存款余额
			num: 1,
			currentAddrIdx: 0,
			invoiceList: [],
			receiveEmailListOrder: [],
			receivingAddrInfo: [],
			diITem: {},
			receivingAddrInfoShow: [],
			receivingAddr: {},
			addAddrModal: false,
			addAddShow: -1,
			addLoading: false,
			addAddrData: {
				contactId: '',
				contactName: '',
				contactCompany: '',
				location: [],
				contactAddress: '',
				contactEmail: '',
				contactMobile: '',
				contactManufacturer: '',
				contactFixPhone: '',
				fixPhone: '',
				extensionNumber: '',
				isDefault: '',
			},
			invoice_mes: {
				obj: '',
				id: '',
				name: '',
			},
			cutGoodsList: [], // 享受预存款优惠的列表
			fee_detail: {},
			cartObg: {},
			editAddrModal: false,
			editLoading: false,
			editaddrData: {
				contactId: '',
				contactName: '',
				contactCompany: '',
				location: [],
				contactAddress: '',
				contactEmail: '',
				contactMobile: '',
				contactManufacturer: '',
				contactFixPhone: '',
				fixPhone: '',
				extensionNumber: '',
				isDefault: '',
			},
			hh: 1,
			isJD: false,
			// 地址
			address: [],
			addressErrInfo: [],
			options3: {
				disabledDate(date) {
					return date && date.valueOf() < Date.now()
				},
			},
			goodsList: [], // 商品清单
			orderInfo: [],
			agrTypeArr: [], // 协议类型
			disabledSatrt: '',
			failOrder: [],
			// 存放库存不足的商品
			notStockList: [],
			// 是否展示库存不足提示
			notStockModal: false,
			// 库存不足的提示语
			notStockText: '',
			// 表单校验规则
			ruleValidate: {
				purchaserAccount: [{ required: true, message: '请选择采购单位' }],
				contactName: [{ required: true, message: '收货人不能为空' }],
				contactManufacturer: [{ required: true, message: '收货单位不能为空' }],
				payType: [{ required: true, message: '付款方式不能为空' }],
				location: [{ required: true, message: '请选择所在地区' }],
				giveTime: [{ required: true, message: '请选择送达时间' }],
				contactAddress: [{ required: true, message: '详细地址不能为空' }],
				contactEmail: [
					{ required: false, message: '邮箱不能为空' },
					{ validator: Validator().email, trigger: 'blur' },
				],
				fixPhone: [],
				extensionNumber: [],
				contactMobile: [
					{ required: true, message: '手机号码不能为空' },
					{
						validator: (rule, value, callback) => {
							if (
								this.addAddrData.contactProvinceName == '香港' ||
								this.addAddrData.contactProvinceName == '澳门' ||
								this.addAddrData.contactProvinceName == '台湾'
							) {
								// 如果field2不等于特定值，或者field1为空，则不进行验证
								callback()
							} else {
								let regexp = /^1[3-9]\d{9}$/
								if (value) {
									if (value.match(regexp)) {
										callback()
									} else {
										callback(new Error('请输入正确格式的手机号'))
									}
								} else {
									callback()
								}
							}
						},
						trigger: 'confirm',
					},
				],
				purContactMobile: [
					{
						type: 'string',
						pattern: /^1[3-9]\d{9}$/,
						message: '请填写有效的手机号',
						trigger: 'blur',
					},
				],
			},
			mergeOrderId: '',
			failedCommodityBoList: [],
			isSubmitSuccess: false,
			disGoOn: false, // 当有禁用商品的时候，是否可以继续
			newData: '', // {}
			newCartInfoData: '', // {}
			cartInfoData: [],
			flag: false,
			cartData: JSON.parse(sessionStorage.getItem('cartInfo')),
			orgClassId: JSON.parse(localStorage.getItem('userData')).userInfo.orgClass,
			companyCName: '',
			leftNum: '',
			activityIds: '',
			measureNames: '',
			resonId: '',
			resonName: '',
			orderQuantitys: '',
			totoPrice: '',
			joinPrices: '',
			unitPrice: '',
			isSettlement: '',
			orderDesc: '',
			options: [],
			dialogAddAddress: false,
			openFlagFrom: {},
			shopSetting: {},
			expandAllShow: false, //展开全部
		}
	},
	components: {
		htHeaderTop,
		htHeaderNonav,
		htCartTopOpModule,
		htPurchaseProcess,
		CascadeOfCity,
		ListTable,
		recommendService,
		InvoiceChoose,
		orderTotalMoney,
		orderSuccess,
		ShopFoot,
		BroadsideNavigation,
		InvoiceReceAddForm,
		InvoiceReceEditForm,
		invoiceInfoAdd,
		invoiceInfoEdit,
	},
	watch: {
		payType(newVal, oldVal) {
			if (newVal != oldVal) {
				/**
				 * @param 2022/3/21 如果是预存款的时查询享受优惠的商品
				 **/
				let orgId = JSON.parse(localStorage.getItem('userData')).userInfo.orgId

				if (newVal == 1) {
					this.cutGoodsList = []
					const cms_deposit = async (params) => {
						let res = await postApi(DYC_URL.cms_deposit, params)
						return res.depositDiscount
					}
					_.map(this.goodsList, (g) => {
						_.map(g.agreementInfoList, (gg) => {
							_.map(gg.uscGoodsInfoList, (ggg) => {
								cms_deposit({
									orgIdWeb: orgId,
									skuClass: Number(ggg.uscUccCommdityBO.skuClass) || 0,
									categoryId: ggg.uscUccCommdityBO.commodityId,
									skuId: ggg.uscUccCommdityBO.skuId,
									skuForm: ggg.uscUccCommdityBO.skuForm,
									purchaseCount: ggg.productAmount,
									measureName: ggg.uscUccCommdityBO.saleUnit,
								}).then((res) => {
									if (res) {
										this.cutGoodsList.push({
											image: ggg.uscUccCommdityBO.image,
										})
									}
								})
							})
						})
					})
				}
				// 不是自提的时候才查运费
				if (
					this.deliveryMethod ||
					this.deliveryMethod == '0' ||
					this.deliveryMethod == '2'
				) {
					this.qryAboutFee()
				} else {
					for (let k in this.fee_detail) {
						this.fee_detail[k] = null
					}
					this.fee_detail.amount = this.cartInfo.modePrice
						? this.cartInfo.modePrice
						: this.cartInfo.totalPrice
					this.fee_detail.fscAmount = this.cartInfo.modePrice
						? this.cartInfo.modePrice
						: this.cartInfo.totalPrice
				}
			}
		},
		deliveryMethod(newVal, oldVal) {
			if (newVal != oldVal) {
				if (
					this.deliveryMethod ||
					this.deliveryMethod == '0' ||
					this.deliveryMethod == '2'
				) {
					this.qryAboutFee()
				} else {
					for (let k in this.fee_detail) {
						this.fee_detail[k] = null
					}
					this.isSelfTi = true
					this.fee_detail.amount = this.cartInfo.modePrice
						? this.cartInfo.modePrice
						: this.cartInfo.totalPrice
					this.fee_detail.fscAmount = this.cartInfo.modePrice
						? this.cartInfo.modePrice
						: this.cartInfo.totalPrice
				}
			}
		},
		invoice_id(newVal, oldVal) {
			if (newVal != oldVal) {
				this.invoiceBO = _.find(this.invoiceList, (item) => item.accountId === newVal)
			}
		},
		needInvoice(newVal, oldVal) {
			if (newVal == 2) {
				this.getInvoiceAddressList() // 查询发票信息
			}
		},
		disabledSatrt(val) {
			this.options3 = {
				disabledDate(date) {
					return date && date.valueOf() < (val ? new Date(val).getTime() : Date.now())
				},
			}
		},
		'invoiceBO.invoiceType': function (val) {
			if (val == '00') {
				this.editBtn = true
			}
		},
	},
	activated() {},
	created() {
		// this.qryPurchaseUnit(); // 查询采购单位
		// this.initTable()
	},
	beforeRouteEnter(to, from, next) {
		console.log('-------------路由from------------', from)
		next((vm) => {
			if (
				from.name == 'unagrdetail' ||
				from.name == 'serveDetail' ||
				from.name == 'eventDetails'
			) {
				vm.directOrderCommonQry()
				vm.flag = true
			}
			if (from.name == 'cart') {
				vm.flag = false
				vm.initTable()
			}
		})
	},
	destroyed() {
		window.removeEventListener('beforeunload', (e) => {
			this.beforeunloadHandler(e)
		})
		sessionStorage.removeItem('orderRes')
		sessionStorage.removeItem('isSubmitSuccess')
	},
	mounted() {
		this.vipCardOrderPayCheck()
		// this.qryShopSettingCheck()
		this.qryKuaidi()
		this.qryPurchaseUnit()
		setTimeout(() => {
			let cartInfoData = JSON.parse(sessionStorage.getItem('cartInfoData'))
			let newCartInfoData = JSON.parse(sessionStorage.getItem('newCartInfoData'))
			if (cartInfoData) {
				this.goodsList = cartInfoData
				let cartInfo = JSON.parse(sessionStorage.getItem('cartInfo'))
				this.cartInfo = cartInfo
				console.log(this.cartInfo, '配送说明============================')
				this.qryShopSettingCheck('1')
			}
			if (newCartInfoData) {
				this.goodsList = newCartInfoData
				// 如果从列表页进来 这样处理一下
				_.forEach(this.goodsList, (v) => {
					_.forEach(v.agreementInfoList, (vv) => {
						_.forEach(vv.uscGoodsInfoList, (vvv) => {
							this.$set(
								vvv.uscUccCommdityBO,
								'price',
								vvv.uscUccCommdityBO.price || 0
							)
						})
					})
				})
				this.cartInfo = newCartInfoData[0]
				if (!this.cartInfo.totalPrice) {
					this.cartInfo.totalPrice = this.$route.query.joinPrice
				}
				console.log('enter ', this.cartInfo)
			}
			this.qryAboutFee() //计算运费接口
			this.getDicData()
		}, 100)
		this.getMerchantPayType()
		this.getMerchantDetail()
		this.getErpCustomerAccountPeriod()
		this.getCustomerDepositList()
		this.qryOrg()
		// 支付渠道后请求地址
		// setTimeout(() => {
		// this.qryAboutFee()
		// }, 600)
		// this.qryPayDetail();
		this.qryReceivingAddr()
		setTimeout(() => {
			this.getPeriodFlag()
		}, 1000)
		setTimeout(() => {
			// this.setFee()
			this.ddd()
			this.checkFun()
		}, 200)
		// this.qryPayChannel();
		// this.qryBalance();
		// this.qryIntegal();
		// this.getUserInfo.memUserType 1 外部个人 2 外部企业 3内部个人 4 内部企业
		window.addEventListener('scroll', this.windowScroll)
		this.cacheFun()
		// this.$nextTick(() => {
		//   setTimeout(() => {
		//     this.flagFun();
		//   }, 2000);
		// });
		let addressJson = JSON.parse(localStorage.getItem('addressJson'))
		addressJson.forEach((citem) => {
			citem.children.forEach((ditem) => {
				ditem.value = ditem.cityCode
				ditem.label = ditem.cityName
				ditem.children.forEach((aitem) => {
					aitem.value = aitem.areaCode
					aitem.label = aitem.areaName
				})
			})
			this.options.push({
				value: citem.provinceCode,
				label: citem.provinceName,
				children: citem.children,
			})
		})
		console.log(this.options, 'provinceData====================')
		/**
		 * @date 2022/09/02
		 * @description 因为下单页面包含了下单 下单成功等页面，每次刷新都会返回到下单初始页面，所以要监听一下刷新事件，做好缓存
		 * @author LiuYun
		 */
		this.$nextTick(() => {
			setTimeout(() => {
				window.addEventListener('beforeunload', (e) => {
					this.beforeunloadHandler(e)
				})
			}, 2000)
		})
		this.leftNum = this.$route.query.leftNum ? this.$route.query.leftNum : ''
		this.activityIds = this.$route.query.activityIds ? this.$route.query.activityIds : ''
		this.measureNames = this.$route.query.measureNames ? this.$route.query.measureNames : ''
		this.resonId = this.$route.query.resonId ? this.$route.query.resonId : ''
		this.resonName = this.$route.query.resonName ? this.$route.query.resonName : ''
		this.totoPrice = this.$route.query.totoPrice ? this.$route.query.totoPrice : ''
		this.joinPrices = this.$route.query.joinPrice ? this.$route.query.joinPrice : ''
		this.unitPrice = this.$route.query.unitPrice ? this.$route.query.unitPrice : ''
		this.isSettlement = this.$route.query.isSettlement ? this.$route.query.isSettlement : ''
		this.orderQuantitys = this.$route.query.orderQuantitys
			? this.$route.query.orderQuantitys
			: ''
		console.log(this.activityIds, 'this.activityIds==============')
		// console.log(this.leftNum, 'this.leftNum==============')
		// console.log(this.measureNames, 'this.measureNames==============')
		// console.log(this.resonId, 'this.resonId==============')
		console.log(this.resonName, 'this.resonName==============')
		// console.log(this.totoPrice, 'this.totoPrice==============')
		// console.log(this.joinPrices, 'this.joinPrices==============')
		// console.log(this.unitPrice, 'this.unitPrice==============')
		// console.log(this.orderQuantitys, 'this.orderQuantitys==============')
	},
	computed: {
		...mapGetters('admin/global.v1', ['getNum', 'getIsLogin', 'getUserInfo', 'getNoReadCount']),

		...mapState('admin/layout.ht', ['layoutTheme']),
		p_str() {
			if (this.payTypeMapList.length) {
				let str = '在线支付'
				if (this.payType == '1') {
					str = `VIP卡支付（${this.$accounting.formatMoney(
						this.customerDepositBalance.cardBalance,
						'￥'
					)}）`
				} else if (this.payType == '2') {
					str = this.singleDiscussion ? '账期支付( 一单一议 )' : '账期支付'
				} else if (this.payType == '3') {
					str = '线下支付'
					let arr = _.filter(this.payDownTypeMapList, (item) => item.value == this.payMod)
					str = arr.length ? `线下支付（${arr[0].title}）` : '线下支付'
				} else if (this.payType == '4') {
					str = '积分兑换'
				}
				return str
			} else {
				return ''
			}
		},
		layoutNavClasses() {
			return [`ht-layout-${this.layoutTheme} `]
		},
		...mapGetters('admin/global.v1', ['getUserInfo']),
		isToggle() {
			return this.visible ? 'ios-arrow-up' : 'ios-arrow-down'
		},
		formAccountId() {
			return this.addFormData.purchaserAccount
		},
	},
	methods: {
		...mapActions('admin/global.v1', ['changeItem', 'getCartNum', 'login']),
		/**
		 *  @description 此方法专用于查活动商品下单方式
		 *  @date  2022/08/02
		 *  @param activityId 活动商品id
		 *  @return 支付方式
		 */
		expandAll() {
			this.expandAllShow = !this.expandAllShow
		},
		// 判断vip卡是否存在
		vipCardOrderPayCheck() {
			postApi(DYC_URL.vipCardOrderPayCheck, {
				operateAmount: '',
				checkAmountFlag: false,
			}).then((res) => {
				console.log('查询vip卡>>>>>>>>>>>>>>>>>>>>>>>>>', res)
				this.openFlagFrom = res.data
			})
		},
		// 配送说明
		qryShopSettingCheck(type) {
			let params = {}
			console.log(type, 'this.newData===========')
			if (type) {
				params = {
					shopId: this.cartInfo.cartInfo[0].supplierShopId,
					supplierId: this.cartInfo.cartInfo[0].supplierId,
					remarkType: 'deliveryRemark',
				}
			} else {
				params = {
					shopId: this.newData.uscSupplierGoodsInfoList[0].supplierShopId,
					supplierId: this.newData.uscSupplierGoodsInfoList[0].supplierId,
					remarkType: 'deliveryRemark',
				}
			}
			postApi(DYC_URL.order_qgetShopRemarkSettingByShopIdAndType, params).then((res) => {
				console.log('配送说明=======================', res, this.goodsList)
				this.shopSetting = res.shopRemarkSetting
				this.shopSetting.remarkContent = res.shopRemarkSetting.remarkContent.replace(
					/\n/g,
					'<br>'
				)
			})
		},
		receiveFromChild(value) {
			this.orderDesc = value
		},
		cacheFun() {
			// console.log('------------------1cacheFun--------------------')
			let isSubmitSuccess = sessionStorage.getItem('isSubmitSuccess')
			if (isSubmitSuccess) {
				let res = sessionStorage.getItem('orderRes')
				if (res) {
					res = JSON.parse(res)

					this.isSubmitSuccess = true
					this.mergeOrderId = res.mergeOrderId
					this.failedCommodityBoList = res.failedCommodityBoList
					this.currindex = '2'
					// console.log('------------------2cacheFun--------------------', this.currindex)
					this.$nextTick(() => {
						let orderArr = [
							...res.failureOrderIds,
							...res.successOrderIds,
							...res.pendingPaymentOrderIds,
						]
						this.$refs.orderSuccess.setTableData(orderArr)
						let cur_index = orderArr.some((item) => item.saleStateStr.indexOf('待付款'))
							? '3'
							: '2'
						this.currindex = cur_index
						// console.log('------------------3cacheFun--------------------', this.currindex)
						this.$refs.orderSuccess.setEndTime(res.paymentTimeLimit)
						window.scrollTo({
							top: 0,
							left: 0,
							behavior: 'smooth',
						})
					})
					/** 仅需要当前区间业务End**/
					this.getCartNum()
					sessionStorage.removeItem('cartInfo')
				}
			}
		},
		// 查询组织机构
		qryOrg() {
			// console.log(this.getIsLogin, 'this.getIsLogin===================')
			// console.log(localStorage.getItem('auth-token'), 'auth-token===================')
			// console.log(common, 'common.auth================')
			if (localStorage.getItem('auth-token') != common.auth) {
				let param = {}
				if (this.getIsLogin) {
					postApi(DYC_URL.umc_qrySubMem, param).then((res) => {
						if (res && res.respCode === CONSTANT.RESP_CODE_SUCCESS) {
							this.orgList = res.rows
							// console.log(this.orgList, '11111111111111111111111111111111111')
							this.selectedOrg = res.rows ? res.rows[0] : {}
							this.selectedOrgId = this.selectedOrg ? this.selectedOrg.orgId : ''
							sessionStorage.setItem('uOrgList', JSON.stringify(this.orgList))
						}
					})
				}
			} else {
				// console.log('22222222222222222222222222222222222')
				let param = {}
				let store = this.storeUser
				if (store) {
					this.orgList = store
					this.selectedOrg = store[0]
					this.selectedOrgId = this.selectedOrg ? this.selectedOrg.orgId : ''
				} else {
					if (this.getIsLogin) {
						postApi(DYC_URL.umc_qrySubMem, param).then((res) => {
							if (res && res.respCode === CONSTANT.RESP_CODE_SUCCESS) {
								this.orgList = res.rows
								this.selectedOrg = res.rows ? res.rows[0] : {}
								this.selectedOrgId = this.selectedOrg ? this.selectedOrg.orgId : ''
								sessionStorage.setItem('uOrgList', JSON.stringify(this.orgList))
							}
						})
					}
				}
			}
			console.log(JSON.parse(sessionStorage.getItem('uOrgList')), '看下组织机构')
			// console.log(this.orgList, '看下组织机构222222222');
		},
		open() {
			// console.log(this.orgList, ',modal----------------')
			if (this.orgList.length > 1) {
				this.modal = true
			}
		},
		changeSeleOrg(value) {
			this.selectedOrgId = value
			console.log(value)
		},
		onModal() {
			let orgId = this.selectedOrgId ? this.selectedOrgId : this.selectedOrg.orgId
			/* let url =location.origin + '/' + PES_URL.cms_switch.control + '?userId=' + userId;
			  location.href = url; */
			let newArr = this.orgList.filter((i) => {
				return i.orgId == orgId
			})
			let userInfo = JSON.parse(localStorage.getItem('userData')).userInfo
			let param = {
				userIdOld: userInfo.userId,
				userIdNew: newArr[0].userId,
				orgIdOld: userInfo.orgId,
				orgIdNew: orgId,
			}
			postApi(DYC_URL.umc_checkSubMem, param).then((res) => {
				if (res) {
					sessionStorage.removeItem('uOrgList')
					util.cookies.remove('auth-token')
					util.cookies.set('auth-token', res.token)
					this.login({}).then((res) => {
						if (res) {
							if (res.tradeUserTypeCook.length == 1) {
								postApi(DYC_URL.common_changeTradeUserType, {
									tradeUserTypeSelect: res.tradeUserTypeCook[0],
								}).then((res) => {
									if (res) {
										this.getUserInfo.tradeUserTypeSelectCook =
											res.tradeUserTypeCook[0]
									}
								})
							}
							this.$router.go(0)
						}
					})
					this.reload()
				}
			})
		},
		async chooseActivityPayType() {
			const activityId = this.$route.query.activityModel
			console.log(this.payTypeMapList[0].value, '============his.payTypeMapList')

			if (activityId) {
				const res = await postApi(DYC_URL.com_activityDetail, { activityId })
				if (res) {
					// 设置枚举值
					const enumPay = {
						0: 'payTypeOnline',
						1: 'payTypeDeposit',
						2: 'payTypeAccount',
						3: 'payTypeOffline',
						5: 'payTypeOfflineTransfer', // 银行转账
						6: 'payTypeOfflineBill', // 承兑汇票
						payTypeOnline: res.payTypeOnline || null,
						payTypeDeposit: res.payTypeDeposit || null,
						payTypeAccount: res.payTypeAccount || null,
						payTypeOffline:
							res.payTypeOfflineTransfer || res.payTypeOfflineBill ? 1 : null,
						payTypeOfflineTransfer: res.payTypeOfflineTransfer || null,
						payTypeOfflineBill: res.payTypeOfflineBill || null,
					}
					this.enumPay = _.assign({}, enumPay)
				}
			}
		},
		beforeunloadHandler(e) {
			e = e || window.event
			sessionStorage.setItem('isSubmitSuccess', this.isSubmitSuccess)
		},
		/**
		 * @description  查询是否显示账期
		 * @date 2022/06/10
		 * @param   {Array } commodityIds  所有下单商品的商品id集合
		 * @return  返回flag 如果true就不显示账期
		 */
		async getPeriodFlag() {
			const commodityIds = []
			_.map(this.goodsList, (v) => {
				_.map(v.agreementInfoList, (vv) => {
					_.map(vv.uscGoodsInfoList, (vvv) => {
						commodityIds.push(vvv.uscUccCommdityBO.commodityId)
					})
				})
			})
			if (!commodityIds.length) {
				setTimeout(() => {
					this.getPeriodFlag()
				}, 500)
			} else {
				const res = await postApi(DYC_URL.order_periodCheck, { commodityIds })
				return res.flag || null
			}
		},
		kuaidiChange(val) {
			if (val) {
				this.qryAboutFee()
			}
		},
		editInfo(flag, item) {
			if (item && item.accountId) {
				console.log(this.invoiceBO.invoiceType, item, 'falrrrr===============')

				this.$refs.invoiceInfoEdit.openMOdelEdit()
				this.$refs.invoiceInfoEdit.invoiceTypeEdit(this.invoiceBO.invoiceType)
				this.$refs.invoiceInfoEdit.detailEdit(item)
			} else {
				this.$Message.warning('没有发票信息，请点击新增发票信息！')
			}
		},

		flagFun() {
			let cartInfo =
				sessionStorage.getItem('cartInfo') ||
				sessionStorage.getItem('newCartInfoData') ||
				sessionStorage.getItem('cartInfoData')
			// console.log ("cartInfo=====================", cartInfo)
			if (!cartInfo) {
				this.$Modal.info({
					title: '提示',
					content: '请返回购物车选择商品下单！',
					onOk: () => {
						this.$router.push({
							name: 'cart',
						})
					},
				})
			}
		},
		
		changeInvoice(item) {
			let obj = {
				name: '',
				id: '',
			}
			let mes =
				_.find(this.invoiceList, (item) => item.invoiceId == this.invoiceBO.invoiceSn) || {}
			if (mes.invoiceId) {
				obj.name = mes.invoiceTitle + mes.invoiceTypeName
				obj.id = mes.invoiceId
			}
			this.invoice_mes = obj
			// return obj;
			for (let i = 0; i < this.invoiceList.length; i++) {
				if (this.invoiceList[i].invoiceId === item) {
					this.detail = this.invoiceList[i]
					// console.log('发票信息===================', this.detail)
					return
				}
			}
		},
		async qryKuaidi() {
			const configKeys = ['PEB_EXPRESS_TYPE_ALL']
			const res = await postApi(DYC_URL.pes_dicConfigQueryData, { configKeys })
			if (res) {
				this.kuaidiList = res.data.PEB_EXPRESS_TYPE_ALL.map((item) => {
					return {
						descrip: item.descrip,
						code: item.code,
					}
				})
				this.$set(this, 'courierCompany', this.kuaidiList[0].code)
				console.log('快递', this.kuaidiList)
			}
		},

		checkSup() {
			let arr = []
			_.forEach(this.goodsList, (v) => {
				_.forEach(v.agreementInfoList, (vv) => {
					_.forEach(vv.uscGoodsInfoList, (vvv) => {
						if (vvv.uscUccCommdityBO.skuSource == 2) {
							arr.push(vvv.uscUccCommdityBO.skuSource)
						}
					})
				})
			})
			return !!arr.length
		},
		ddd() {
			// console.log(this.selectData.purchaseUnit);
			let userName = JSON.parse(localStorage.getItem('userData')).userInfo.name
			let userData = localStorage.getItem('userData')
			let userInfo = {}
			if (userData) {
				userInfo = JSON.parse(userData).userInfo
			}
			this.addFormData.purContactName = userName || ''
			this.addFormData.purContactMobile = userInfo.cellphone
			setTimeout(() => {
				if (this.selectData.purchaseUnit && this.selectData.purchaseUnit.length) {
					if (this.selectData.purchaseUnit[0].telephone) {
						if (!this.addFormData.purContactMobile) {
							this.addFormData.purContactMobile = userInfo.cellphone
						}
					}
				}
			}, 500)
			// debugger;
		},
		// 查询支付信息
		// qryPayDetail () {
		//   let merchantId = JSON.parse(localStorage.getItem('userData')).userInfo.orgId;
		//   postApi(DYC_URL.pay_qryMerchantDetail, { merchantId }).then(res => {
		//     if (res) {
		//       console.log(res);
		//     }
		//   });
		// },
		// 查询运费等信息
		qryAboutFee() {
			let payTypeStrs = ['ONLINE', 'DEPOSIT', 'PERIOD', 'OFFLINE']
			let arr = []
			_.forEach(this.goodsList, (i) => {
				_.forEach(i.agreementInfoList, (s) => {
					_.forEach(s.uscGoodsInfoList, (k) => {
						let stockAreaId = 'NO'
						let addressStartProvinceCode, addressStartCityCode, cityCode, provinceCode
						if (this.$route.query.stockHouseId) {
							stockAreaId = this.$route.query.stockHouseId
						} else {
							stockAreaId = k.uscUccCommdityBO.stockAreaId
								? k.uscUccCommdityBO.stockAreaId
								: k.uscUccCommdityBO.stockInfoList &&
								  k.uscUccCommdityBO.stockInfoList.length
								? k.uscUccCommdityBO.stockInfoList[0].stockAreaId
								: 'NO'
						}
						let element = {
							commodityId: k.uscUccCommdityBO.commodityId,
							stockAreaCode: stockAreaId,
							skuId: k.uscUccCommdityBO.skuId,
							num: k.productAmount,
							isSelfTi: false,
							// addressStartProvinceCode,
							// addressStartCityCode,
							activityId: this.$route.query.activityModel || '',
							supplierShopId: k.uscUccCommdityBO.supplierShopId,
						}
						if (
							k.uscUccCommdityBO.stockInfoList &&
							k.uscUccCommdityBO.stockInfoList.length
						) {
							let fArr = k.uscUccCommdityBO.stockInfoList.filter(
								(item) => item.stockAreaId == k.uscUccCommdityBO.stockAreaId
							)
							cityCode = fArr.length ? fArr[0].city : ''
							provinceCode = fArr.length ? fArr[0].province : ''
						}
						if (cityCode) {
							element.addressStartCityCode = cityCode
							element.addressStartProvinceCode = provinceCode
						}
						if (this.$route.query.cityCode) {
							element.addressStartCityCode = this.$route.query.cityCode
							element.addressStartProvinceCode = this.$route.query.provinceCode
						}
						arr.push(element)
					})
				})
			})
			let params = {
				payType: this.payTypeMapList.length ? payTypeStrs[Number(this.payType)] : '',
				confType: this.deliveryMethod,
				periodType: this.erpCustomerAccountPeriod.accountPeriodDescription,
				addressEndProvinceCode: this.addFormData.addressInfo.contactProvinceId || 'NO',
				addressEndCityCode: this.addFormData.addressInfo.contactCityId,
				skuOrderList: arr,
				expressType: this.deliveryMethod == '0' ? this.courierCompany : '',
				orgIdIn: '1',
				province: '',
				city: '',
				county: '',
				// activity: this.$route.query.isActivity ? 1 : 0,
				activity: this.$route.query.isActivity,
				town: '',
				companyId: '1',
				isprofess: '1',
				orderType: 0,
			}
			console.log(params.skuOrderList)
			if (!params.payType && params.payType != 0) {
				return false
			}
			if (!params.skuOrderList.length) {
				return false
			}
			params.orderType = 0
			postApi(DYC_URL.common_querySpuOrderListInfo, params).then((res) => {
				if (res) {
					this.shipmentsRemark = res.shipmentsRemark // 发货地提示
					this.fee_detail = _.assign({}, res)
					if (!this.feeFlag) {
						window.fee_detail = _.assign({}, res)
					}
					res.orderSpuList.forEach((iic) => {
						console.log(iic, 'iic==================iic')
						this.goodsList[0].agreementInfoList[0].uscGoodsInfoList.forEach((iid) => {
							if (iid.uscUccCommdityBO.commodityName == iic.commodityName) {
								iid.uscUccCommdityBO.specStr = iic.orderSkuList[0].specStr
								if (iic.orderSkuList[0].skuSpec.length > 0) {
									iid.uscUccCommdityBO.skuProperteis[0].skuPicUrl =
										iic.orderSkuList[0].skuSpec[0].skuPicUrl
								}
							}
						})
					})
					console.log('计算运费>>>>>>>>>>>>>>>>>>>>>>>>>>>', res)
					this.orderTotalMoney.saleFeeMoney = res.amount // 商品总金额
					this.orderTotalMoney.transFeeMoney = res.freightAmount // 运费
					this.orderTotalMoney.totalSaleFeeMoney = res.fscAmount // 结算总金额（含运费）
					this.feeFlag = true
					this.isSelfTi = false
					// this.$nextTick(() => {
					// setTimeout(() => {
					_.forEach(this.goodsList, (v) => {
						v.totalFreight = 0
						_.forEach(v.agreementInfoList, (vv) => {
							_.forEach(vv.uscGoodsInfoList, (vvv) => {
								let arr = _.filter(
									res.orderSpuList,
									(gg) => gg.commodityName == vvv.uscUccCommdityBO.commodityName
								)
								if (arr.length) {
									_.map(arr, (s) => {
										s.totalFreight = 0
										_.map(s.orderSkuList, (ss) => {
											if (vvv.skuId == ss.skuId) {
												this.$set(
													vvv.uscUccCommdityBO,
													'freight',
													ss.freight
												)
												this.$set(vvv.uscUccCommdityBO, 'wait', ss.wait)
												this.$set(vvv.uscUccCommdityBO, 'isSelfTi', false)
												this.$set(
													vvv.uscUccCommdityBO,
													'discountPrice',
													ss.discountPrice
												)
												this.$set(
													vvv.uscUccCommdityBO,
													'price',
													this.$route.query.activityModel
														? Number(ss.skuPrice)
														: Number(ss.skuPrice)
												)
												this.$set(
													vvv,
													'totalPrice',
													Number(vvv.uscUccCommdityBO.price) *
														Number(vvv.productAmount) || 0
												)
												// 如果是活动商品
												if (this.$route.query.activityModel) {
													this.$set(v, 'totalPrice', vvv.totalPrice)
												}
												let freight = ss.freight ? Number(ss.freight) : 0
												let totalFreight = v.totalFreight
													? Number(v.totalFreight)
													: 0
												this.$set(v, 'totalFreight', totalFreight + freight)
											}
										})
									})
								}
							})
						})
					})
					// }, 500)
					// })
				}
			})
			// }, 500)
		},
		// 修改发票邮寄地址
		editInvoic(item) {
			this.$refs.InvoiceReceEditForm.id = item.id
			this.$refs.InvoiceReceEditForm.editInvoiceModel = true
			this.$refs.InvoiceReceEditForm.init()
		},
		// 选择收货地址
		choosePostInvoic(item, index) {
			this.chooseReceiveInvoic.postAddress = item
			this.chooseReceiveInvoic.id = item.id
			this.currentInvoicIdx = index
		},
		// setFee() {
		// let feeObj = JSON.parse(sessionStorage.getItem('cartInfo'))
		// console.log('>>>>>>>>>>>>>>>>>>>setFee>>>>>>>>>>>>>>>>>>>>>>>>', feeObj)
		// if (feeObj) {
		// 	this.orderTotalMoney.totalSaleFeeMoney = feeObj.modePrice
		// 	this.orderTotalMoney.saleFeeMoney = feeObj.modePrice
		// }
		// },
		windowScroll() {
			let winHeight = document.documentElement.clientHeight || document.body.clientHeight
			if (document.body.scrollHeight - document.documentElement.scrollTop - winHeight > 380) {
				this.htPlaceOrderFixed = true
			} else {
				this.htPlaceOrderFixed = false
			}
		},
		// 商户公有支付方式
		async getMerchantPayType() {
			let orgIdList = []
			let skuClassList = []
			this.payTypeMapList = []
			this.payDownTypeMapList = []
			this.accountPeriodPayTypeMapList = []
			this.goodsList.forEach((item) => {
				item.agreementInfoList.forEach((agreementItem) => {
					agreementItem.uscGoodsInfoList.forEach((goodItem) => {
						orgIdList.push(goodItem.uscUccCommdityBO.vendorId)
						skuClassList.push(Number(goodItem.uscUccCommdityBO.skuClass) || 0)
					})
				})
			})
			// 判断是否有服务订单的标识
			let serviceFlag = skuClassList.includes(1)
			// console.log(this.goodsList, 'skuClassList=======================');
			let parmas = {
				orgIdList,
			}
			if (!parmas.orgIdList.length) {
				setTimeout(() => {
					this.payTypeMapList = []
					this.payDownTypeMapList = []
					this.accountPeriodPayTypeMapList = []
					this.getMerchantPayType()
				}, 500)
			} else {
				if (!parmas.orgIdList.length) {
					setTimeout(() => {
						this.getMerchantPayType()
					}, 500)
				}
				postApi(DYC_URL.order_qryMerchantPayType, parmas).then(async (res) => {
					if (res) {
						/**
						 * @param 2022/2/23 如果选择商品中有服务订单，则付款方式只有线上和线下 skuClass 0 物资 1 服务
						 */
						for (let key in res.payTypeMap) {
							console.log(
								key,
								res.payTypeMap[key],
								'res.payTypeMap[key]======================'
							)
							this.payTypeMapList.push({
								value: key,
								title: res.payTypeMap[key],
							})
						}
						if (serviceFlag) {
							this.payTypeMapList = this.payTypeMapList.filter((item) => {
								return item.value == '0' || item.value == '3'
							})
						}
						const SHOW_PERIOD = await this.getPeriodFlag()
						if (SHOW_PERIOD) {
							this.payTypeMapList = this.payTypeMapList.filter((item) => {
								return item.value != '2'
							})
						}
						// vip
						if (this.openFlagFrom.openFlag == false) {
							console.log('111111111111111111111111')
							this.payTypeMapList = this.payTypeMapList.filter((item) => {
								return item.title != 'VIP卡支付'
							})
						}
						console.log(this.payTypeMapList, 'this.payTypeMapList')
						this.payType = this.payTypeMapList[0].value
						console.log(this.payType, '=======this.payType00')
						console.log(res.accountPeriodPayTypeMap, '12==12')
						if (res.accountPeriodPayTypeMap) {
							for (let key in res.accountPeriodPayTypeMap) {
								this.accountPeriodPayTypeMapList.push({
									value: key,
									title: res.accountPeriodPayTypeMap[key],
								})
								console.log(this.accountPeriodPayTypeMapList, '12-121-12--')
								this.payMod = this.accountPeriodPayTypeMapList[0].value
							}
						}
						_.forEach(this.payTypeMapList, (item) => {
							const arr = ['1', '2']
							if (item.value == '2') {
								let orderSkuList = []
								_.forEach(this.goodsList, (i) => {
									_.forEach(i.agreementInfoList, (s) => {
										_.forEach(s.uscGoodsInfoList, (k) => {
											let obj = {
												price: k.uscUccCommdityBO.price,
												skuId: k.skuId,
												num: parseFloat(k.uscUccCommdityBO.saleNum),
												commodityId: k.uscUccCommdityBO.commodityId,
											}
											orderSkuList.push(obj)
										})
									})
								})
								// console.log('商品数量>>>>>>>>>>>>>>>>', orderSkuList)
								postApi(DYC_URL.order_judgeAccountPeriodPay, {
									orderSkuList: orderSkuList,
								})
									.then(async (res1) => {
										if (!res1.flag) {
											this.payTypeMapList.forEach((elem, index) => {
												if (elem.value == 2) {
													this.payTypeMapList.splice(index, 1)
												}
											})
											this.payType = this.payTypeMapList[0].value

											console.log(this.payType, '=======this.payType11')
										} else {
											postApi(DYC_URL.order_fetchErpAccountPeriod, {
												ecommerceNo: JSON.parse(
													localStorage.getItem('userData')
												).userInfo.orgId,
											})
												.then((res2) => {
													// console.log('接口返回>>>>>>>>>>>>>>>>', res2.erpAccountPeriodList)
													this.periodRules.unshift({
														value: res2.erpAccountPeriodList[0].ruler,
														title: res2.erpAccountPeriodList[0].ruler,
													})
													this.billingPeriodRule =
														res2.erpAccountPeriodList[0].ruler
												})
												.catch((err1) => {})
										}
									})
									.catch((err) => {})
							}
						})
						for (let key in res.payDownTypeMap) {
							this.payDownTypeMapList.push({
								value: key,
								title: res.payDownTypeMap[key],
							})
							// this.payMod = this.payDownTypeMapList[2].value
							this.payMod = this.payDownTypeMapList[0].value
						}

						this.chooseActivityPayType()
					}
				})
			}
		},
		checkFun() {
			/**
			 * @param 如果购买的商品中含有包含个人身份的卖家商品 需要提示
			 * */
			const checkIsUser = (supplierId) => {
				let params = {
					orgIdWeb: supplierId,
				}
				postApi(DYC_URL.common_qryEnterpriseOrgDetail, params).then((res) => {
					if (res) {
						// this.userSupList.push()
						if (
							res.enterpriseOrgBO.orgClass == 1 ||
							res.enterpriseOrgBO.orgClass == 3
						) {
							this.userSupList.push(res.enterpriseOrgBO.orgClass)
						}
						if (this.userSupList.length) {
							this.$Modal.confirm({
								title: '提示',
								content:
									'您所提交购买的商品，包含个人身份的卖家商品，存在一定的发票开具风险（手撕票、无法开票），是否继续？',
								onOk: () => {
									console.log('ok')
								},
								onCancel: () => {
									this.$router.push({
										name: 'cart',
									})
								},
							})
						} else {
							console.log('can order')
						}
					}
				})
			}
			_.map(this.goodsList, (g) => {
				checkIsUser(g.supplierId)
			})
		},
		// 分组更新库存
		groupQryStock() {
			if (
				JSON.parse(localStorage.getItem('userData')).userInfo.tradeUserTypeSelectCook == '2'
			) {
				// 判断当前用户是供应商身份2
				// 您只有供应商身份，暂时无法下单，有问题请及时联系您的企业管理员。
				this.$Modal.confirm({
					title: '提示',
					content: '您只有供应商身份，暂时无法下单，有问题请及时联系您的企业管理员。',
					onOk: () => {},
				})
				return
			}
			if (!this.canSubmit) {
				this.$Message.warning({
					content: '您没有开通京东采购权限，请联系领布商城供应链',
				})
			}
			let that = this
			this.disGoOn = false
			// 查询库存信息
			let groupList = []
			// 存放库存不足的商品
			this.notStockList = []
			// 存放所有的商品
			let allGoodList = []
			// 存放所有的供应商
			let allSupplierShop = []
			// 存放所有的提示语句数组
			let notStockTextList = []
			that.goodsList.forEach((item) => {
				if (this.orderDesc) {
					item.orderDesc = this.orderDesc
				}
				item.agreementInfoList.forEach((agreementItem) => {
					agreementItem.uscGoodsInfoList.forEach((goodItem) => {
						let obj = {
							supplierShopId: goodItem.uscUccCommdityBO.supplierShopId,
							skuId: goodItem.skuId,
							skuClass: goodItem.skuClass,
							skuForm: goodItem.skuForm,
							skuSource: goodItem.skuSource,
							// owner: goodItem.stockInfoList && goodItem.stockInfoList.length ? goodItem.stockInfoList[0].stockMasterName
							num: goodItem.productAmount,
							province: that.addFormData.addressInfo.contactProvinceId,
							county: that.addFormData.addressInfo.contactCountyId,
							city: that.addFormData.addressInfo.contactCityId,
							town: that.addFormData.addressInfo.contactTownId,
						}
						goodItem.supplierId = item.supplierId
						goodItem.supplierName = item.supplierName
						allGoodList.push(goodItem)
						groupList.push(obj)
					})
				})
				allSupplierShop.push({
					supplierId: item.supplierId,
					supplierName: item.supplierName,
					children: [],
				})
			})
			/**
			 * @param
			 * 1.供方的物资 调用原来查库存接口 供方的服务不用调接口
			 * 2.自营的物资 （现货 样品）调用erp库存接口 订购调用原来查库存的接口
			 * 3.自营的服务不用调用接口
			 * 4. skuSource 1.自营 2.供方
			 * 5. skuClass  1.物资 2.服务
			 * 6. skuForm   0.现货 1.样品 2以上订购
			 */
			if (this.addFormData.purContactMobile) {
				this.createOrder(0)
				// postApi(DYC_URL.m_queryGoodsStock, { skuIdList: groupList.map(item => item.skuId) }).then(res => {
				//   if (res) {
				//     if (!res.commodityStockBOList.length) {
				//       this.$Modal.info({
				//         title: '提示',
				//         content: '商品没有库存信息，无法下单，请返回购物车重新下单',
				//         onOk: () => {
				//           this.$router.push({ name: 'cart' });
				//         }
				//       });

				//       return false;
				//     }
				//     allGoodList.forEach(good => {
				//       res.commodityStockBOList.forEach((item, index) => {
				//         if (item.unsaleNum > -1) {
				//           if (item.unsaleNum < good.productAmount && good.skuId == item.skuId) {
				//             that.notStockList.push(good);
				//           }
				//         }
				//       });
				//     });
				//     // 当有商品是库存不足就展示提示，当没有就直接生成订单
				//     if (that.notStockList.length > 0) {
				//       that.notStockModal = true;
				//       allSupplierShop.forEach(shopItem => {
				//         that.notStockList.forEach(notStockItem => {
				//           if (shopItem.supplierId == notStockItem.supplierId) {
				//             shopItem.children.push(notStockItem);
				//           }
				//         });
				//         // 存放商品编码
				//         let childNum = [];
				//         if (shopItem.children.length > 0) {
				//           shopItem.children.forEach(shopItemChild => {
				//             childNum.push(shopItemChild.skuId);
				//           });
				//           notStockTextList.push(
				//             shopItem.supplierName + '商品编码为' + childNum.join(',') + '的商品'
				//           );
				//         }
				//       });
				//       // 当所有商品都没有库存的时候，就禁用继续
				//       if (allGoodList.length == that.notStockList.length) {
				//         this.disGoOn = true;
				//       }
				//       this.notStockText = notStockTextList.join(',') + '库存不足，无法下单';
				//     } else {
				//       this.createOrder(0);
				//     }
				//   }
				// });
			} else {
				this.createOrder(0)
			}
		},
		async toOpenOrderModal() {
			console.log(this.goodsList, 'valid=======================')
			if (
				this.payType == 1 &&
				this.openFlagFrom.openFlag == true &&
				this.openFlagFrom.accountBalance <= 0
			) {
				this.$Message.warning('VIP卡余额不足')
				return
			}
			var yNum = 0
			this.goodsList.forEach((item) => {
				yNum += Number(item.totalPrice)
			})
			console.log(yNum.toFixed(3), 'yNum====================')
			if (
				this.payType == 1 &&
				this.openFlagFrom.openFlag == true &&
				this.openFlagFrom.accountBalance < yNum.toFixed(3)
			) {
				this.$Message.warning('VIP卡余额不足')
				return
			}
			const valid = await this.$refs.uniInfoData.validate()
			if (valid) {
				if (!this.receivingAddrInfoShow.length && this.deliveryMethod != 2) {
					this.$Message.warning('请先选择收货地址')
					return
				}
				if (
					this.needInvoice == '2' &&
					this.invoice_mes.id != '' &&
					this.invoiceList.length == 0
				) {
					this.$Message.warning('发票不能为空,请在发票信息中新增发票!')
					return
				}
				// if (this.needInvoice == '1') {
				// } else {
				// 	if (this.detail && this.detail.receiveEmail) {
				// 		console.log(this.detail, '==invoice_mes=======================')
				// 	} else {
				// 		this.$Message.warning('发票邮箱不能为空，请在发票信息--编辑里面进行添加！')
				// 		return
				// 	}
				// }
				let arr = this.invoiceList.filter(
					(item) => item.invoiceId === this.invoiceBO.invoiceSn
				)
				this.invoice_mes.id = arr.length ? arr[0].invoiceId : ''
				this.invoice_mes.name = arr.length
					? arr[0].invoiceTitle + arr[0].invoiceTypeName
					: ''
				this.invoice_mes.invoiceTypeName = arr.length ? arr[0].invoiceTypeName : ''
				this.invoice_mes.accountName = arr.length ? arr[0].accountName : ''
				// this.invoice_mes.receiveEmail = arr.length ? arr[0].receiveEmail : ''
				this.orderCheckModal = true

				if (this.deliveryMethod == 0) {
					this.kuaidiList.forEach((cy) => {
						if (cy.code == this.courierCompany) {
							this.companyCName = cy.descrip
						}
					})
				} else {
					this.companyCName = ''
				}
			}
		},
		// 额度查询
		qryBalance() {
			let param = {}
			postApi(DYC_URL.mall_queryDeptBudgetBalance, param).then((res) => {
				if (res) {
					if (res.rows && res.rows.length) {
						this.balanceMoney = res.rows[0].balance
					}
				}
			})
		},
		// 积分查询
		qryIntegal() {
			let type = Number(this.cartObg.selectedOrderSouce)
			switch (type) {
				case 2:
					postApi(DYC_URL.fsc_qryPayConfigDetailOrPayConfig, {
						exceptId: this.getUserInfo.companyId,
						payBusiType: '0',
					}).then((res) => {
						if (res) {
							this.integal1 = res.balance
						}
					})
					break
				case 3:
					postApi(DYC_URL.fsc_qryPayConfigDetailOrPayConfig, {
						exceptId: this.getUserInfo.companyId,
						payBusiType: '1',
					}).then((res) => {
						if (res) {
							this.integal2 = res.balance
						}
					})
					postApi(DYC_URL.fsc_qryPayConfigDetailOrPayConfig, {
						exceptId: this.getUserInfo.companyId,
						payBusiType: '2',
					}).then((res) => {
						if (res) {
							this.integal3 = res.balance
						}
					})
					break
			}
		},
		changeDate(value) {
			this.addFormData.giveTime = value
		},
		payTypeChange(e) {
			console.log(e, 'e==================1')
			if (e == 2) {
				this.payMod = this.accountPeriodPayTypeMapList[0].value
			} else if (e == 3) {
				this.payMod = this.accountPeriodPayTypeMapList[0].value
			} else {
				this.payMod = ''
			}
		},
		editInvoiceSuccess() {
			// console.log('ersererrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr')
			this.invoiceTitleChange()
		},
		invoiceTitleChange(val) {
			console.log('发票抬头类型val', val)
			this.getInvoiceListNew()
			// this.getInvoiceList()
			setTimeout(() => {
				let mes = this.invoiceList.length ? this.invoiceList[0] : { name: '', id: '' }
				let obj = {}
				console.log(this.invoiceList,'this.invoiceList=====1')
				if (mes.invoiceId) {
					obj.name = mes.invoiceTitle + mes.invoiceTypeName
					obj.id = mes.invoiceId
				}
				this.invoice_mes = obj
			}, 500)
		},
		// 获取立即购买带过来的商品
		directOrderCommonQry() {
			let params = {
				skuID: this.$route.query.skuID,
				productAmount: this.$route.query.productAmount,
				supplierShopId: this.$route.query.supplierShopId,
				joinPrice: this.$route.query.joinPrice,
			}
			console.log('获取立即购买带过来的商品=======================================', params)
			postApi(DYC_URL.dy_directOrderCommonQry, params).then((res) => {
				console.log('thisnew=======================', res)
				if (res) {
					this.priceDis =
						res.uscSupplierGoodsInfoList[0].agreementInfoList[0].uscGoodsInfoList[0]
							.uscUccCommdityBO.priceDis || 0
					this.newData = res
					this.detailInitTable()
					this.qryShopSettingCheck()
					if (
						this.deliveryMethod ||
						this.deliveryMethod == '0' ||
						this.deliveryMethod == '2'
					) {
						this.qryAboutFee()
					} else {
						for (let k in this.fee_detail) {
							this.fee_detail[k] = null
						}
						setTimeout(() => {
							this.fee_detail.amount = this.cartInfo.modePrice
								? this.cartInfo.modePrice
								: this.cartInfo.totalPrice
							this.fee_detail.fscAmount = this.cartInfo.modePrice
								? this.cartInfo.modePrice
								: this.cartInfo.totalPrice
						}, 300)
					}
				}
			})
		},
		// 详情页初始化商品列表
		detailInitTable() {
			this.newCartInfoData = this.newData
			if (!this.newCartInfoData) {
				this.$Modal.info({
					title: '提示',
					content: '===！',
					onOk: () => {
						this.$router.push({
							name: 'cart',
						})
					},
				})
				return
			}
			console.log(this.goodsList, 'this.goodsList=this.goodsList=this.goodsList')
			if (this.newCartInfoData) {
				this.goodsList = this.newCartInfoData.uscSupplierGoodsInfoList
				this.goodsList.forEach((item) => {
					this.$set(item, 'orderDesc', '')
				})
			}
			sessionStorage.setItem('newCartInfoData', JSON.stringify(this.goodsList))
			this.flagFun()
		},
		// 初始化商品列表
		initTable() {
			let cartInfoData = JSON.parse(sessionStorage.getItem('cartInfo'))
			this.cartInfoData = cartInfoData
			if (!cartInfoData) {
				this.$Modal.info({
					title: '提示',
					content: '请返回购物车选择商品下单6666666666666666！',
					onOk: () => {
						this.$router.push({
							name: 'cart',
						})
					},
				})
				return
			}
			if (cartInfoData) {
				this.goodsList = cartInfoData.cartInfo
				this.goodsList.forEach((item) => {
					this.$set(item, 'orderDesc', '')
				})
				if (this.deliveryMethod || this.deliveryMethod == '0') {
					this.qryAboutFee()
				} else {
					for (let k in this.fee_detail) {
						this.fee_detail[k] = null
					}
					this.fee_detail.amount = this.cartInfo.modePrice
						? this.cartInfo.modePrice
						: this.cartInfo.totalPrice
					this.fee_detail.fscAmount = this.cartInfo.modePrice
						? this.cartInfo.modePrice
						: this.cartInfo.totalPrice
				}
			}
			sessionStorage.setItem('cartInfoData', JSON.stringify(this.goodsList))
			this.flagFun()
		},
		// 送达日期查询
		qryPayTime(item) {
			let param = {
				addressInfo: {
					receiverCountryId: item.contactCountryId,
					receiverCountryName: item.contactCountryName,
					receiverProvinceId: item.contactProvinceId,
					receiverProvinceName: item.contactProvinceName,
					receiverCityId: item.contactCityId,
					receiverCityName: item.contactCityName,
					receiverCountyId: item.contactCountyId,
					receiverCountyName: item.contactCountyName,
					receiverTownId: item.contactTownId,
					receiverTown: item.contactTown,
					receiverAddress: item.contactAddress,
					receiverName: item.contactName,
					receiverFixPhone: item.contactFixPhone,
					receiverMobileNumber: item.contactMobile,
					contactManufacturer: item.contactManufacturer,
					receiverEmail: item.contactEmail,
				},
				skuInfo: [],
			}
			let flag = false
			_.forEach(this.goodsList, (i) => {
				if (
					i.supplierName == '京东门店' ||
					i.supplierId == '100055' ||
					i.supplierName == '京东'
				) {
					flag = true
				}
				_.forEach(i.agreementInfoList, (s) => {
					_.forEach(s.uscGoodsInfoList, (k) => {
						let obj = {
							skuId: k.skuId,
							purchaseCount: k.productAmount,
						}
						param.skuInfo.push(obj)
					})
				})
			})
			if (flag) {
				postApi(DYC_URL.mall_queryDeliveryTimeRange, param).then((res) => {
					if (res) {
						this.disabledSatrt = res.purchaseCount
					}
				})
			}
		},
		// 查询运费
		qryFeeMoney(item) {
			console.log('>>>>>>>>>>>>>>>>>>>查询运费>>>>>>>>>>>>>>>>>>>>>>>>1')
			let skuArr = []
			_.forEach(this.goodsList, (i) => {
				let obj = {
					sku: [],
					supplierShopId: i.supplierId,
					province: item.contactProvinceId,
					city: item.contactCityId,
					county: item.contactCountyId,
					town: item.contactTownId,
					paymentType:
						i.supplierName == '京东门店' ||
						i.supplierId == '100055' ||
						i.supplierName == '京东'
							? this.addFormData.payType
							: '',
				}
				_.forEach(i.agreementInfoList, (k) => {
					_.forEach(k.uscGoodsInfoList, (g) => {
						let obj1 = {
							skuId: g.skuId,
							num: g.productAmount,
						}
						obj.sku.push(obj1)
					})
				})
				skuArr.push(obj)
			})
			let params = {
				freightList: skuArr,
			}
			console.log(JSON.stringify(params), 'liang')
			postApi(DYC_URL.peb_queryGoodsFreight, params).then((res) => {
				if (res) {
					_.forEach(this.goodsList, (it, ik) => {
						_.forEach(res.freightBOList, (st) => {
							if (it.supplierId == st.supplierId) {
								it.freight = st.freight
								this.$set(this.goodsList, ik, it)
							}
						})
					})
					console.log('>>>>>>>>>>>>>>>>>>>查询运费>>>>>>>>>>>>>>>>>>>>>>>>2')
					// this.orderTotalMoney.transFeeMoney = res.totalFreight
					// this.orderTotalMoney.totalSaleFeeMoney = this.orderTotalMoney.saleFeeMoney.add(
					// 	this.orderTotalMoney.transFeeMoney
					// )
				}
			})
		},
		// 关闭弹框
		closeErrModal() {
			this.isWuErrModal = false
		},
		// 查看更多信息
		showMoreErr() {
			this.isShowMoreErr = !this.isShowMoreErr
		},
		// 区域购买限制实时查询
		qryAreaAvailable(i) {
			let skuIds = []
			_.forEach(this.goodsList, (item) => {
				_.forEach(item.agreementInfoList, (sItem) => {
					_.forEach(sItem.uscGoodsInfoList, (kItem) => {
						let obj = {
							skuId: kItem.skuId,
							supplierShopId: kItem.uscUccCommdityBO.supplierShopId,
							province: i.contactProvinceId,
							city: i.contactCityId,
							county: i.contactCountyId,
							town: i.contactTownId,
						}
						skuIds.push(obj)
					})
				})
			})
			postApi(DYC_URL.m_queryAreaAvailable, { areaAvailableSkuInfo: skuIds }).then((res) => {
				if (res) {
					let arr = []
					_.forEach(res.areaAvailableCommdInfos, (item) => {
						if (item.areaRestrict) {
							arr.push(item)
						}
					})
					this.addressErrInfo = [...arr]
				}
			})
		},
		// 查询采购单位
		qryPurchaseUnit() {
			this.$Spin.show()
			let userData = localStorage.getItem('userData')
			let userInfo = {}
			if (userData) {
				userInfo = JSON.parse(userData).userInfo
			}
			postApi(DYC_URL.m_queryProcureDept, {}).then((res) => {
				this.$Spin.hide()
				if (res) {
					this.selectData.purchaseUnit = res.rows
					if (res.rows && res.rows.length == 1) {
						this.addFormData.purchaserAccount = res.rows[0].accountId
						this.addFormData.purchaserName =
							userInfo.companyName || res.rows[0].accountName
					}
				}
			})
		},
		// 查询收货地址信息
		qryReceivingAddr(parmasd) {
			let param = {
				operType: 5,
			}
			this.$Spin.show()
			postApi(DYC_URL.m_queryReceiveAddress, param).then((res) => {
				this.$Spin.hide()
				if (res) {
					if (res.rows && res.rows.length) {
						if (parmasd) {
							this.receivingAddrInfo = []
							this.receivingAddrInfo = res.rows
							console.log(res.rows, 'res.rows================')
							res.rows.forEach((item, index) => {
								if (item.contactId == parmasd.contactId) {
									console.log(item, 'item=================')
									let ditem = res.rows.splice(index, 1)[0] // 从数组中移除该项并获得它
									console.log(this.receivingAddrInfo, 'ditem=================')
									this.receivingAddrInfo.unshift(ditem) // 将该项插入到数组的开头
								}
							})
						} else {
							this.receivingAddrInfo = res.rows
						}
						console.log(this.receivingAddrInfo, 'this.receivingAddrInfo=======23')
						if (this.visible === true) {
							this.addFormData.addressInfo.contactId = 0
							this.receivingAddrInfoShow = JSON.parse(
								JSON.stringify(this.receivingAddrInfo)
							)
							this.$nextTick(() => {
								this.addFormData.addressInfo = this.receivingAddrInfo[0]
							})
						} else {
							this.addFormData.addressInfo = this.receivingAddrInfo[0]
							this.receivingAddrInfoShow = JSON.parse(
								JSON.stringify(this.receivingAddrInfo)
							).splice(0, 1)
						}
						this.currentAddrIdx = 0
						// 电子超市查询运费和区域限制
						if (this.cartObg.selectedOrderSouce == 2) {
							this.qryFeeMoney(res.rows[0])
							this.qryAreaAvailable(res.rows[0])
							this.qryPayTime(res.rows[0])
						}
					} else {
						this.receivingAddrInfo = []
						this.receivingAddrInfoShow = []
						this.addFormData.addressInfo = {}
						this.currentAddrIdx = 0
					}
				}
			})
		},
		handleChange(value) {
			this.options.forEach((item) => {
				if (item.value == value[0]) {
					console.log(item)
					this.addAddrData.contactProvinceId = item.value
					this.addAddrData.contactProvinceName = item.label
					item.children.forEach((citem) => {
						if (citem.value == value[1]) {
							this.addAddrData.contactCityId = citem.value
							this.addAddrData.contactCityName = citem.label
							citem.children.forEach((ditem) => {
								if (ditem.value == value[2]) {
									this.addAddrData.contactCountyId = ditem.value
									this.addAddrData.contactCountyName = ditem.label
									this.addAddrData.contactTownId = 0
									this.addAddrData.contactTown = ''
								}
							})
						}
					})
				}
			})
		},
		handleChange1(value) {
			this.options.forEach((item) => {
				if (item.value == value[0]) {
					console.log(item)
					this.editaddrData.contactProvinceId = item.value
					this.editaddrData.contactProvinceName = item.label
					item.children.forEach((citem) => {
						if (citem.value == value[1]) {
							this.editaddrData.contactCityId = citem.value
							this.editaddrData.contactCityName = citem.label
							citem.children.forEach((ditem) => {
								if (ditem.value == value[2]) {
									this.editaddrData.contactCountyId = ditem.value
									this.editaddrData.contactCountyName = ditem.label
									this.editaddrData.contactTownId = 0
									this.editaddrData.contactTown = ''
								}
							})
						}
					})
				}
			})
		},
		// 地址选择完成-新增
		addAddrChange(value, selectedData) {
			this.addAddrData.contactProvinceId = value.selectedData[0].value
			this.addAddrData.contactProvinceName = value.selectedData[0].label
			this.addAddrData.contactCityId = value.selectedData[1].value
			this.addAddrData.contactCityName = value.selectedData[1].label
			this.addAddrData.contactCountyId = value.selectedData[2].value
			this.addAddrData.contactCountyName = value.selectedData[2].label
			this.addAddrData.contactTownId = value.selectedData[3] ? value.selectedData[3].value : 0
			this.addAddrData.contactTown = value.selectedData[3] ? value.selectedData[3].label : ''
		},
		// 显示新增发票信息模态框
		openInvoiceModel() {
			this.$refs.invoiceInfoAdd.openMOdel()
		},
		// 显示新增收货地址模态框
		showAddAddrModal() {
			console.log(this.$refs, 'this.$refs================')
			// this.$refs["addAddrForm"].resetFields();
			// this.addAddrModal = true
			this.$nextTick(() => {
				this.$refs['addAddrForm'].resetFields()
			})
			this.dialogAddAddress = true
		},
		// 新增收货地址
		addAttr() {
			console.log(this.addAddrData.contactProvinceName, 'params==================')
			this.$refs['addAddrForm'].validate((valid) => {
				if (valid) {
					if (
						this.addAddrData.fixPhone !== '' &&
						this.addAddrData.extensionNumber !== ''
					) {
						this.addAddrData.contactFixPhone = `${this.addAddrData.fixPhone} -${this.addAddrData.extensionNumber} `
					} else if (
						this.addAddrData.fixPhone !== '' &&
						this.addAddrData.extensionNumber === ''
					) {
						this.addAddrData.contactFixPhone = this.addAddrData.fixPhone
					} else {
						this.addAddrData.contactFixPhone = ''
					}
					if (
						this.addAddrData.contactMobile == '' &&
						this.addAddrData.contactFixPhone == ''
					) {
						this.$Modal.error({
							title: '错误',
							content: '请输入手机号或者座机号',
						})
						return
					}
					let params = this.addAddrData
					this.addLoading = true
					postApi(DYC_URL.m_addReceiveAddress, params).then((res) => {
						this.addLoading = false
						if (res) {
							console.log(res.receiveAddress, 'res=================================')
							this.dialogAddAddress = false
							this.addAddShow = 1
							this.$Message.success({
								content: res.respDesc ? res.respDesc : '新增收货地址成功！',
							})
							this.qryReceivingAddr(res.receiveAddress)
							setTimeout(() => {
								console.log(this.receivingAddrInfoShow, 'receivingAddrInfoShow===1')
								this.receivingAddrInfoShow.forEach((item, index) => {
									if (item.contactId == res.contactId) {
										this.addFormData.addressInfo = item
										this.currentAddrIdx = index
									}
								})
							}, 1000)
							this.qryAboutFee()
						}
					})
				}
			})
		},
		// 修改收货地址信息
		showEidtAttrModel(item) {
			this.$nextTick(() => {
				this.$refs['editAddrForm'].resetFields()
			})
			this.editAddrModal = true
			console.log(item, 'item========================')
			this.$set(this, 'editaddrData', item)
			this.editaddrData.location = [
				item.contactProvinceId,
				item.contactCityId,
				item.contactCountyId,
			]
			if (item.contactFixPhone) {
				let arr = item.contactFixPhone.split('-')
				console.log(arr, 'arr===================================')
				if (arr.length == 2) {
					this.editaddrData.fixPhone = arr[0]
					this.editaddrData.extensionNumber = arr[1]
				} else {
					this.editaddrData.fixPhone = arr[0] + '-' + arr[1]
					this.editaddrData.extensionNumber = ''
				}
			} else {
				this.editaddrData.contactFixPhone = ''
				this.editaddrData.fixPhone = ''
				this.editaddrData.extensionNumber = ''
			}
			this.qryAboutFee()
		},
		// 修改收货地址
		editAttr() {
			this.$refs['editAddrForm'].validate((valid) => {
				if (valid) {
					if (
						this.editaddrData.fixPhone !== '' &&
						this.editaddrData.extensionNumber !== ''
					) {
						this.editaddrData.contactFixPhone = `${this.editaddrData.fixPhone} -${this.editaddrData.extensionNumber}`
					} else if (
						this.editaddrData.fixPhone !== '' &&
						this.editaddrData.extensionNumber === ''
					) {
						this.editaddrData.contactFixPhone = this.editaddrData.fixPhone
					} else {
						this.editaddrData.contactFixPhone = ''
					}
					if (
						this.editaddrData.contactMobile == '' &&
						this.editaddrData.contactFixPhone == ''
					) {
						this.$Modal.error({
							title: '错误',
							content: '请输入手机号或者座机号',
						})
						return
					}
					let params = this.editaddrData
					this.editLoading = true
					postApi(DYC_URL.m_updateReceiveAddress, params).then((res) => {
						this.editLoading = false
						if (res) {
							this.editAddrModal = false
							this.$Message.success({
								content: res.respDesc ? res.respDesc : '修改成功！',
								duration: 2,
								closable: true,
							})
							console.log(res, 'res===============修改成功')
							this.qryReceivingAddr(res.receiveAddress)
							this.qryAboutFee()
						}
					})
				}
			})
		},
		// 设置默认地址
		setDefaulte(contactId) {
			let params = {
				operType: 4, // 操作类型（1：新增；2：修改；3：删除；4：设置默认；5：查询）
				contactId: contactId,
			}
			this.$Spin.show()
			postApi(DYC_URL.m_setDefaultAddress, params).then((res) => {
				this.$Spin.hide()
				if (res) {
					this.$Message.success({
						content: res.respDesc ? res.respDesc : '设置默认收货地址成功！',
					})
					this.qryReceivingAddr()
				}
			})
		},
		// 删除收货地址
		delAttr(contactId) {
			this.$Modal.confirm({
				title: '提示',
				content: '确定要删除吗?',
				onOk: () => {
					let params = {
						contactId: contactId,
						logisticsRelaList: [{ contactId: contactId }],
					}
					this.$Spin.show()
					postApi(DYC_URL.m_deleteReceiveAddress, params).then((res) => {
						this.$Spin.hide()
						if (res) {
							this.$Message.success({
								content: res.respDesc ? res.respDesc : '删除成功！',
							})
							this.qryReceivingAddr()
						}
					})
				},
			})
		},
		// 展开或收起收货地址
		toggle() {
			this.visible = !this.visible
			this.visible
				? (this.receivingAddrInfoShow = this.receivingAddrInfo)
				: (this.receivingAddrInfoShow = JSON.parse(
						JSON.stringify(this.receivingAddrInfo)
				  ).splice(0, 1))
		},
		// 选择收货地址
		changeSendAddr(e, item, index, flag) {
			console.log(e, item, index, flag, 'item, index======================')
			if (flag == 0) {
				var arr = this.receivingAddrInfoShow
				var obj = {}
				arr.forEach((iitem, iindex) => {
					if (
						iitem.contactAddress == item.contactAddress &&
						iitem.contactCityName == item.contactCityName &&
						iitem.contactCountyName == item.contactCountyName &&
						iitem.contactManufacturer == item.contactManufacturer &&
						iitem.contactCityId == item.contactCityId &&
						iitem.contactCountyId == item.contactCountyId &&
						iitem.contactProvinceName == item.contactProvinceName &&
						iitem.contactProvinceId == item.contactProvinceId &&
						iitem.contactName == item.contactName &&
						iitem.contactMobile == item.contactMobile
					) {
						console.log(iitem, 'iitemmm-----------------')
						obj = iitem
						arr.splice(iindex, 1)
						return
					}
				})
				// console.log(obj, 'onjjjjjj------------------')
				arr.unshift(obj)
				this.addFormData.addressInfo = item
				this.currentAddrIdx = index
				this.visible = !this.visible
				this.visible
					? (this.receivingAddrInfoShow = this.receivingAddrInfo)
					: (this.receivingAddrInfoShow = JSON.parse(
							JSON.stringify(this.receivingAddrInfo)
					  ).splice(0, 1))
				// 电子超市查询运费和区域限制
				if (this.cartObg.selectedOrderSouce == 2) {
					this.qryFeeMoney(item)
					this.qryAreaAvailable(item)
					this.qryPayTime(item)
				}
				this.qryAboutFee()
			}
			return
		},
		// 选择采购单位
		changePurchaserAccount(item) {
			this.addFormData.purchaserName = item.accountName
		},
		handleRemove(file, fileList) {
			_.forEach(this.addFormData.accessoryList, (item, index) => {
				if (item.accessoryName == file.name) {
					this.addFormData.accessoryList.splice(index, 1)
				}
			})
		},
		// 格式错误
		formatError() {
			this.$Message.error('文件格式不正确！')
		},
		// 上传文件
		handleSuccess(res, file, fileList) {
			if (res) {
				let obj = _.assign(
					{ attachmentType: 0, accessoryId: 0 },
					_.pick(res.data.fileList[0], ['name', 'url'])
				)
				obj.accessoryUrl = obj.url
				obj.accessoryName = obj.name
				delete obj.url
				delete obj.name
				this.addFormData.accessoryList.push(obj)
			}
		},
		getDicData() {
			let configKeys = ['peb_delivery_method', 'fsc_invoice_type', 'fsc_user_invoice_type']
			postApi(DYC_URL.pes_dicConfigQueryData, { configKeys }).then((dictRes) => {
				if (dictRes.respCode == '0000') {
					this.dictData = dictRes.data
					this.invoiceBO.invoiceType = this.dictData['fsc_invoice_type'][0].code
					this.invoiceBO.invoiceTitle = this.dictData['fsc_user_invoice_type'][0].code
					// orgClassId  机构类别 1 外部个人 2 外部企业 3内部个人 4 内部企业
					if (this.orgClassId == 1) {
						this.invoiceBO.invoiceType = this.dictData['fsc_invoice_type'][1].code
						this.invoiceBO.invoiceTitle = this.dictData['fsc_user_invoice_type'][1].code
					}
					// this.invoiceBO.receiveEmail=this.detail.receiveEmail
					console.log(
						this.invoiceBO,
						this.detail,
						'发票类型invoiceType==增票code00==普票code01==================='
					)
					console.log(
						this.invoiceBO.invoiceTitle,
						'发票抬头类型invoiceTitle==企业1==个人2==================='
					)
					// this.checkSup(); // 判断是否存在供方
					//setTimeout(() => {
					let flag = this.checkSup()
					if (flag) {
						let arr = _.filter(
							this.dictData['peb_delivery_method'],
							(item) => item.code == '0'
						)
						this.dictData['peb_delivery_method'] = arr
					}
					this.deliveryMethod = this.dictData['peb_delivery_method'][0].code
					//}, 500)
					// this.getInvoiceList()
					this.getInvoiceListNew()
				}
			})
		},
		// 校验额度
		checkBalance() {
			if (
				this.balanceMoney !== '' &&
				this.orderTotalMoney.totalSaleFeeMoney > this.balanceMoney
			) {
				this.$Modal.warning({
					title: '提示',
					content: '您所选商品的金额超过部门年度预算余额，请重新选择商品！',
				})
				return false
			}
			if (this.cartObg.selectedOrderSouce == 2 && this.payType == 2) {
				// 电子超市
				// 针对模式是交易模式的商品进行判断
				if (this.integal1 !== '' && this.modePrice > this.integal1) {
					this.$Modal.warning({
						title: '提示',
						content: '您所选商品的金额超过剩余授信额度，请重新选择商品！',
					})
					return false
				}
			}
			if (this.cartObg.selectedOrderSouce == 3 && this.payType == 2) {
				// 专区
				// 针对模式是贸易模式、且为平台协议的商品进行判断
				if (this.integal2 !== '' && this.platformPrice > this.integal2) {
					this.$Modal.warning({
						title: '提示',
						content: '您所选商品的金额超过平台协议剩余授信额度，请重新选择商品！',
					})
					return false
				}
				// 针对模式是贸易模式、且为单位协议的商品进行判断
				if (this.integal3 !== '' && this.companyPrice > this.integal3) {
					this.$Modal.warning({
						title: '提示',
						content: '您所选商品的金额超过单位协议剩余授信额度，请重新选择商品！',
					})
					return false
				}
			}
			return true
		},
		/**
		 * 生成订单
		 * @params isPreOrder 是否是预订单（1是，0不是）
		 */
		createOrder(isPreOrder) {
			if (!this.addFormData.purContactMobile) {
				this.$Message.warning('请填写下单人电话')
				return false
			}
			this.notStockModal = false
			this.$refs['uniInfoData'].validate((valid) => {
				if (valid) {
					// 校验收货地址
					if (
						Object.keys(this.addFormData.addressInfo).length === 0 &&
						this.deliveryMethod != 2
					) {
						this.$Modal.error({
							title: '提示',
							content: '收货地址不能为空!',
						})
						return
					}
					// 专票发票邮寄地址校验
					// if (
					// 	this.needInvoice == '2' &&
					// 	this.invoiceBO.invoiceType == '00' &&
					// 	!this.chooseReceiveInvoic.id
					// ) {
					// 	this.$Modal.warning({
					// 		title: '提示',
					// 		content: '专票发票邮寄地址不能为空！',
					// 	})
					// 	return
					// }
					let invoiceAddressInfo = {}
					let invoiceBO = {}
					if (this.needInvoice == '2') {
						if (this.chooseReceiveInvoic.id) {
							// 暂时注释
							// this.$refs.invoiceChoose.updateInvoiceAdd();// 更新邮寄地址的接受电话和邮箱
							let companyName = JSON.parse(localStorage.getItem('userData'))
								? JSON.parse(localStorage.getItem('userData')).userInfo.companyName
								: ''
							invoiceAddressInfo = {
								receiverCountryId: this.chooseReceiveInvoic.postAddress.countryId,
								receiverCountryName:
									this.chooseReceiveInvoic.postAddress.countryName,
								receiverProvinceId: this.chooseReceiveInvoic.postAddress.provinceId,
								receiverProvinceName:
									this.chooseReceiveInvoic.postAddress.provinceName,
								receiverCityId: this.chooseReceiveInvoic.postAddress.cityId,
								receiverCityName: this.chooseReceiveInvoic.postAddress.cityName,
								receiverCountyId: this.chooseReceiveInvoic.postAddress.countyId,
								receiverCountyName: this.chooseReceiveInvoic.postAddress.countyName,
								receiverTownId: this.chooseReceiveInvoic.postAddress.townId,
								receiverTown: this.chooseReceiveInvoic.postAddress.townName,
								receiverAddress: this.chooseReceiveInvoic.postAddress.addrDesc,
								receiverCompany: companyName,
								receiverName: this.chooseReceiveInvoic.postAddress.contactNameWeb,
								receiverFixPhone: this.chooseReceiveInvoic.postAddress.specialPlane,
								receiverMobileNumber: this.chooseReceiveInvoic.getInvoiceTel
									? this.chooseReceiveInvoic.getInvoiceTel
									: this.chooseReceiveInvoic.postAddress.tel,
								receiverEmail: this.chooseReceiveInvoic.postAddress.elcInvoiceEmail,
								receiverManufacturerName:
									this.addFormData.addressInfo.contactManufacturer,
							}
						} else {
							invoiceAddressInfo = null
						}
						if (this.detail.invoiceId) {
							invoiceBO = {
								outInvoiceId: this.detail.invoiceId,
								invoiceType: this.detail.invoiceType,
								buyerName: this.detail.invoiceTitle,
								fixPhone: this.detail.phone,
								receiveEmail: this.detail.receiveEmail,
								invoiceNo: this.detail.taxpayerId,
								companyAddress: this.detail.address,
								depositBank: this.detail.bank,
								bankAccount: this.detail.account,
								umcInvoiceId: this.detail.invoiceId,
								invoceCategory: this.detail.invoiceClass,
								// addressBo: invoiceAddressInfo,
								relaEmail: this.detail.receiveEmail,
								relaPhone:
									this.detail.invoiceType == '02'
										? this.getUserInfo.cellphone
											? this.getUserInfo.cellphone
											: this.chooseReceiveInvoic.postAddress.tel
										: '', // 联系人电话
							}
						} else {
							invoiceBO = null
						}
					}
					// 校验是否有区域限制
					if (this.addressErrInfo.length) {
						this.isWuErrModal = true
						return
					}

					const user_info = JSON.parse(localStorage.getItem('userData')).userInfo
					let params = {
						purNo: user_info.companyId, // 客户机构ID
						purName: this.addFormData.purchaserName, // 账套名称
						purPlaceOrderId: user_info.userIdIn, // 下单人userId
						purPlaceOrderName: this.addFormData.purContactName, // 下单人名字
						purMobile: this.addFormData.purContactMobile, // 下单人联系电话
						contactManufacturer: this.addFormData.contactManufacturer,
						totalAmount: this.orderTotalMoney.totalSaleFeeMoney, // 结算总金额
						deliveryMethod: Number(this.deliveryMethod), // 配送方式
						payType: this.payTypeMapList.length ? Number(this.payType) : '',
						payMod: this.payMod ? this.payMod : '',
						orderType: 0,
						isActivity: this.$route.query.isActivity,
						activityId: this.$route.query.activityModel || null,
						periodType: this.erpCustomerAccountPeriod.accountPeriodDescription || '',
						pointOrder: false,
						cardNo: this.customerDepositBalance['cardNo'] || null,
						courierCompany: this.deliveryMethod == 0 ? this.courierCompany : '',
						giveTime: this.addFormData.giveTime, // 送货时间要求 N
						comment: this.addFormData.remark, // 备注 N
						purchaserId: this.baseData.companyId, // 采购单位编号 N
						addressBo: {
							receiverCountryId: this.addFormData.addressInfo.contactCountryId,
							receiverCountryName: this.addFormData.addressInfo.contactCountryName,
							receiverProvinceId: this.addFormData.addressInfo.contactProvinceId,
							receiverProvinceName: this.addFormData.addressInfo.contactProvinceName,
							receiverCityId: this.addFormData.addressInfo.contactCityId,
							receiverCityName: this.addFormData.addressInfo.contactCityName,
							receiverCountyId: this.addFormData.addressInfo.contactCountyId,
							receiverCountyName: this.addFormData.addressInfo.contactCountyName,
							receiverTownId: this.addFormData.addressInfo.contactTownId,
							receiverTown: this.addFormData.addressInfo.contactTown,
							receiverAddress: this.addFormData.addressInfo.contactAddress,
							receiverName: this.addFormData.addressInfo.contactName,
							receiverFixPhone: this.addFormData.addressInfo.contactFixPhone,
							receiverMobileNumber: this.addFormData.addressInfo.contactMobile,
							receiverEmail: this.addFormData.addressInfo.contactEmail,
							receiverManufacturerName:
								this.addFormData.addressInfo.contactManufacturer,
						}, // 地址信息                 N
						itemBos: [], // 订单详情 N
						tatleTransportationFee: this.orderTotalMoney.transFeeMoney, // 总运费 N
						accessoryList: this.addFormData.accessoryList, // 附件信息 N
					}
					if (Number(this.deliveryMethod) == 2) {
						params.addressBo = {}
					}
					if (this.payType == 2) {
						if (this.billingPeriodRule == '一单一议') {
							params['singleDiscussion'] = 1
						} else {
							params['singleDiscussion'] = 0
							params['billingPeriodRule'] = this.billingPeriodRule
						}
					} else {
						params['singleDiscussion'] = ''
					}
					if (this.needInvoice == 2) {
						params['invoiceBO'] = invoiceBO
					}
					// 获取所有库存不足的商品skuId
					let notStockIds = []
					if (this.notStockList.length > 0) {
						this.notStockList.forEach((notStockItem) => {
							notStockIds.push(notStockItem.skuId)
						})
					}
					_.forEach(this.goodsList, (i) => {
						_.forEach(i.agreementInfoList, (s) => {
							_.forEach(s.uscGoodsInfoList, (k) => {
								console.log(k, 'kkkkkkkkk==================')
								let skuInfo = {
									skuClass: k.uscUccCommdityBO.skuClass,
									rootCategoryName: k.uscUccCommdityBO.rootCategoryName
										? k.uscUccCommdityBO.rootCategoryName
										: k.rootCategoryName,
									skuName: k.uscUccCommdityBO.skuName,
									skuSource: k.uscUccCommdityBO.skuSource,
									skuForm: k.uscUccCommdityBO.skuForm,
									skuId: k.uscUccCommdityBO.skuId,
									purchType: k.purchaseModId || 2, // 计划非计划
									planItemNo: k.planCode,
									planItemId: k.planItemNo,
									planId: k.planNo,
									goodsSupplierId:
										k.uscUccCommdityBO.skuSource === 1
											? k.uscUccCommdityBO.vendorId
											: i.supplierId, // 无协议传vendorId
									skuSupplierName:
										k.uscUccCommdityBO.skuSource === 1
											? k.uscUccCommdityBO.vendorName
											: i.supplierName, // 无协议传vendorName,
									skuSalePrice: k.uscUccCommdityBO.price,
									purchaseCount: k.productAmount,
									skuMaterialName: k.uscUccCommdityBO.materialName,
									skuMaterialId: k.uscUccCommdityBO.materialId,
									skuMaterialTypeName: k.uscUccCommdityBO.catalogName,
									skuMaterialTypeId: k.uscUccCommdityBO.catalogId,
									vendorOrderType: k.uscUccCommdityBO.isFactoryShip,
									comparisonGoodsNo: k.comparisonGoodsNo,
									spuId: k.uscUccCommdityBO.commodityId,
									supplierShopId: k.uscUccCommdityBO.supplierShopId,
									channel: k.channelId ? k.channelId : '1001',
									channelName: k.channelName,
									isMro: k.isMro ? 1 : 0,
									skuProperteis: k.uscUccCommdityBO.skuProperteis
										? k.uscUccCommdityBO.skuProperteis
										: [],
									stockInfoList: k.uscUccCommdityBO.stockInfoList
										? k.uscUccCommdityBO.stockInfoList
										: [],
									stockAreaCode: k.uscUccCommdityBO.stockAreaId
										? k.uscUccCommdityBO.stockAreaId
										: k.uscUccCommdityBO.stockInfoList.length
										? k.uscUccCommdityBO.stockInfoList[0].stockAreaId
										: '',
									supNo: k.uscUccCommdityBO.vendorId || '',
									orderDesc: i.orderDesc,
									orderSource: this.codeMapping[k.uscUccCommdityBO.skuSource],
									skuMainPicUrl: k.uscUccCommdityBO.image,
									agrId: s.agreementId,
								}
								skuInfo.stockAreaCode = this.stockFilter(k.uscUccCommdityBO)
								console.log(skuInfo, 'skuInfo=================')
								if (this.notStockList.length > 0) {
									if (notStockIds.indexOf(k.skuId) < 0) {
										// if (skuInfo.stockInfoList.length > 0 && k.uscUccCommdityBO.skuClass == '0') {
										params.itemBos.push(skuInfo)
										// } else if (k.uscUccCommdityBO.skuClass == '1') {
										// params.itemBos.push(skuInfo);
										// }
									}
								} else {
									let cityCode, provinceCode
									if (
										k.uscUccCommdityBO.stockInfoList &&
										k.uscUccCommdityBO.stockInfoList.length
									) {
										let fArr = k.uscUccCommdityBO.stockInfoList.filter(
											(item) =>
												item.stockAreaId == k.uscUccCommdityBO.stockAreaId
										)
										cityCode = fArr.length ? fArr[0].city : ''
									}
									if (cityCode) {
										skuInfo.addressStartCityCode = cityCode
										skuInfo.addressStartProvinceCode = provinceCode
									}
									if (this.$route.query.cityCode) {
										skuInfo.addressStartCityCode = this.$route.query.cityCode
										skuInfo.addressStartProvinceCode =
											this.$route.query.provinceCode
									}
									params.itemBos.push(skuInfo)
								}
							})
						})
					})

					if (this.isClicked) {
						return
					}
					this.isClicked = true
					// console.log(params, 'params')
					this.$Spin.show()
					params.orderCode = this.fee_detail.orderCode
					if (!params.itemBos || !params.itemBos.length) {
						this.$Modal.info({
							title: '提示',
							content: '当前商品没有库存信息，请返回购物车重新下单',
						})
						setTimeout(() => {
							this.$Spin.hide()
						}, 1000)
					} else {
						console.log('生成订单------>>>>>>>>>>>>>>>>>>>>>>>>-------', params)
						if (this.activityIds) {
							params.itemBos.forEach((cll) => {
								cll.activityId = this.activityIds
								cll.purchaseCount = this.orderQuantitys
								cll.stockAreaCode = this.resonId
								cll.stockAreaName = this.resonName
							})
							console.log(params, '11111111111111111111111')
							postApi(DYC_URL.dy_createActivityOrder, params).then((res) => {
								setTimeout(() => {
									this.$Spin.hide()
									this.orderCheckModal = false
								}, 1000)
								this.isClicked = false
								if (res) {
									/** 仅需要当前区间业务Begin**/
									sessionStorage.setItem('orderRes', JSON.stringify(res))
									this.isSubmitSuccess = true
									sessionStorage.setItem('isSubmitSuccess', this.isSubmitSuccess)
									this.mergeOrderId = res.mergeOrderId
									this.failedCommodityBoList = res.failedCommodityBoList
									this.currindex = '2'
									this.$nextTick(() => {
										let orderArr = [
											...res.failureOrderIds,
											...res.successOrderIds,
											...res.pendingPaymentOrderIds,
										]
										this.$refs.orderSuccess.setTableData(orderArr)
										let cur_index = orderArr.some((item) =>
											item.saleStateStr.indexOf('待付款')
										)
											? '3'
											: '2'
										this.currindex = cur_index
										this.$refs.orderSuccess.setEndTime(res.paymentTimeLimit)
										window.scrollTo({
											top: 0,
											left: 0,
											behavior: 'smooth',
										})
									})
									/** 仅需要当前区间业务End**/
									this.getCartNum()
									sessionStorage.removeItem('cartInfo')
								}
							})
						} else {
							if (this.$route.query.indent && this.$route.query.indent == 'indent') {
								postApi(DYC_URL.cnnc_createDueOrder, params).then((res) => {
									setTimeout(() => {
										this.$Spin.hide()
										this.orderCheckModal = false
									}, 1000)
									this.isClicked = false
									if (res) {
										/** 仅需要当前区间业务Begin**/
										sessionStorage.setItem('orderRes', JSON.stringify(res))
										this.isSubmitSuccess = true
										sessionStorage.setItem(
											'isSubmitSuccess',
											this.isSubmitSuccess
										)
										this.mergeOrderId = res.mergeOrderId
										this.failedCommodityBoList = res.failedCommodityBoList
										this.currindex = '2'
										this.$nextTick(() => {
											let orderArr = [
												...res.failureOrderIds,
												...res.successOrderIds,
												...res.pendingPaymentOrderIds,
											]
											this.$refs.orderSuccess.setTableData(orderArr)
											let cur_index = orderArr.some((item) =>
												item.saleStateStr.indexOf('待付款')
											)
												? '3'
												: '2'
											this.currindex = cur_index
											this.$refs.orderSuccess.setEndTime(res.paymentTimeLimit)
											window.scrollTo({
												top: 0,
												left: 0,
												behavior: 'smooth',
											})
										})
										/** 仅需要当前区间业务End**/
										this.getCartNum()
										sessionStorage.removeItem('cartInfo')
									}
								})
							} else {
								postApi(DYC_URL.cnnc_mergeCreateOrder, params).then((res) => {
									setTimeout(() => {
										this.$Spin.hide()
										this.orderCheckModal = false
									}, 1000)
									this.isClicked = false
									if (res) {
										/** 仅需要当前区间业务Begin**/
										sessionStorage.setItem('orderRes', JSON.stringify(res))
										this.isSubmitSuccess = true
										sessionStorage.setItem(
											'isSubmitSuccess',
											this.isSubmitSuccess
										)
										this.mergeOrderId = res.mergeOrderId
										this.failedCommodityBoList = res.failedCommodityBoList
										this.currindex = '2'
										this.$nextTick(() => {
											let orderArr = [
												...res.failureOrderIds,
												...res.successOrderIds,
												...res.pendingPaymentOrderIds,
											]
											this.$refs.orderSuccess.setTableData(orderArr)
											let cur_index = orderArr.some((item) =>
												item.saleStateStr.indexOf('待付款')
											)
												? '3'
												: '2'
											this.currindex = cur_index
											this.$refs.orderSuccess.setEndTime(res.paymentTimeLimit)
											window.scrollTo({
												top: 0,
												left: 0,
												behavior: 'smooth',
											})
										})

										/** 仅需要当前区间业务End**/
										this.getCartNum()
										sessionStorage.removeItem('cartInfo')
									}
								})
							}
						}
					}
				}
			})
		},

		stockFilter(obj) {
			let routeId = ''
			routeId = this.$route.query.stockHouseId
			let res = ''
			if (routeId) {
				let arr1 = obj.stockInfoList.filter((item) => item.stockAreaId == routeId)
				res = arr1.length ? arr1[0].stockAreaId : ''
			} else {
				if (obj.stockAreaId) {
					let arr2 = obj.stockInfoList.filter(
						(item) => item.stockAreaId == obj.stockAreaId
					)
					res = arr2.length ? arr2[0].stockAreaId : ''
				} else if (obj.stockInfoList.length > 0) {
					res = obj.stockInfoList[0].stockAreaId
				} else {
					res = ''
				}
			}
			return res
		},
		orderSuceess(type) {
			// 1 15秒内全部成功或失败 2 接口报错 3 15秒内部分成功
			this.flow = 2
			this.flowData[1].class = 'disabled'
			this.flowData[2].class = 'active'
			this.headTitle = '提交订单'
			this.orderInfo = this.failOrder.concat(this.orderInfo)
			this.isAsking = false
			clearInterval(this.timer)
			if (type == 3) {
				this.$Modal.success({
					title: '下单完成',
					content: '下单完成,如有还未下单完成的外部订单请点击我的订单进行查看',
				})
			}
		},
		// 轮询外部订单是否下单成功
		qryOrderIsSuccess(arr) {
			if (this.qryCount > 1) {
				let query = { orderStatusList: arr }
				postApi(DYC_URL.peb_queryOrderStatus, query).then((res) => {
					if (res) {
						this.orderInfo = [...res.orderInfo]
						let flag = false
						_.forEach(this.orderInfo, (item) => {
							if (item.resultCode == 2) {
								// 有处理中 继续轮询
								flag = true
							}
						})
						// 所有订单完成清楚定时器 不用等到15秒
						if (flag) {
							this.qryCount--
							this.isAsking = true
						} else {
							this.orderSuceess(1)
						}
					} else {
						// 报错 清除定时器
						this.orderSuceess(2)
					}
				})
			} else {
				// 15秒到 清除定时器
				this.orderSuceess(3)
			}
		},
		// 返回购物车
		goBack() {
			this.notStockModal = false
			this.$router.push({
				name: 'cart',
			})
		},
		goBackDetail() {
			this.$router.go(-1)
		},
		// 我的订单
		myOrder() {
			this.$router.push({
				name: 'myOrderExt',
			})
			this.changeItem({ data: 'myOrderExt', isVue: 0 })
		},
		// 选择地址
		changeAddress(value) {},
		// 返回首页
		goHome() {
			this.$router.push({
				name: '/',
			})
		},
	},
}
</script>

<style scoped lang="less">
.titile {
	color: #999999;
}

.payType-notice {
	.common_notice {
		background: #e6f7ff;
		height: auto;
		line-height: 40px;
		padding-left: 16px;
		color: #666666;

		.hui-title {
			vertical-align: top;
		}

		.dtels-img {
			width: 80px;
			height: 80px;
			margin: 10px;
		}
	}

	.hui-notice {
		height: 140px;
		border: 1px solid;
		border-color: rgba(145, 213, 255, 1);

		> div:first-child {
			height: 40px;
			line-height: 40px;
			background: #e6f7ff;
			padding-left: 6px;

			> span {
				margin: 0 16px;
			}
		}

		> div:nth-child(2) {
			p {
				margin-top: 10px;
				padding-left: 5px;
				vertical-align: top;
			}

			img {
				width: 80px;
				height: 80px;
				border: 1px solid black;
				display: inline-block;
				margin: 4px;
			}

			padding-left: 16px;
		}
	}

	font-size: 12px;
	margin: 10px;
}

.invoice-form {
	padding: 8px;
	padding-left: 100px;
	margin: 8px;
	width: 100%;

	form {
		background: #f7f7f7;
	}
}

.invoice-select {
	width: 300px;
	transform: translateY(-6px);
	z-index: 999;
}

.stock-title {
	font-size: 16px;
	font-weight: bold;
	vertical-align: middle;
	display: inline-block;
}

.seller-text {
	color: red;
	font-size: 14px;
	font-weight: bolder;
}

/deep/ .ivu-form-item-error-tip {
	padding-top: 2px;
}

/deep/ .ht-layout-top {
	position: relative;
}

.info-icon {
	width: 12px;
	height: 12px;
	transform: translateY(2px);
}

.hui {
	width: 20px;
	height: 20px;
	// display: inline-block;
	padding: 2px;
	background-color: rgb(0, 125, 228);
	border: none;
	border-radius: 4px;
	box-shadow: none;
	font-family: MicrosoftYaHei, 微软雅黑;
	font-weight: 400;
	font-style: normal;
	font-size: 12px;
	color: rgb(255, 255, 255);
}

.single {
	display: inline-block;
	margin-left: 50px;
}

.offline-notice {
	background: #e6f7ff;
	padding-left: 16px;
	line-height: 35px;
	color: #666666;
	position: relative;

	.dtels-left {
		// float: left;
	}

	.line {
		position: absolute;
		left: 480px;
		height: 100%;
		top: 20px;
		// width: 1px;
		height: 100px;
		border: 1px solid #dedede;
	}

	.dtels-right {
		position: absolute;
		right: 16px;
		top: 16px;
	}
}

.cart-table {
	.titile {
		width: 120px;
		line-height: 40px;
		text-align: center;
		color: #cc0000;
		border-bottom: 2px solid #cc0000;
		z-index: 1;
	}
}

.s-table {
	td {
		word-break: break-word;
	}
}

.m-table {
	.i-color {
		color: #cc0000;
	}

	.i-gray {
		color: #cdcdcd;
	}

	.i-blue {
		color: #2d9feb;
	}

	.elli {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: normal !important;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		word-break: break-all;
	}

	.t-title {
		height: 40px;
		text-align: center;
		line-height: 40px;
		background: #f7f7f7;
		font-weight: 700;
		font-size: 14px;
	}

	.t-agreement {
		height: 40px;
		line-height: 40px;
		border-top: 1px solid #dedede;
		position: relative;
		background: #e3edf9;
	}

	.t-check {
		position: absolute;
		top: 0;
		left: 10px;
	}

	.s-goods {
		padding: 10px;

		.s-image,
		.s-goods-info,
		.s-spec {
			vertical-align: top;
		}

		.s-image {
			width: 80px;
			cursor: pointer;
			height: 80px;
		}

		.s-goods-info {
			text-align: left;
		}

		.s-spec {
			color: #cdcdcd;
			font-size: 12px;

			p {
				height: 24px;
				line-height: 24px;
				overflow: hidden;
				width: 90px;
				text-overflow: ellipsis;
				white-space: nowrap;
			}
		}
	}
}

/deep/ .ivu-form {
	position: relative !important;

	.btn {
		display: inline-block;
		margin-left: 10px;

		button {
			width: 60px;
			height: 32px;
			line-height: 32px;
			border: none;
			background-color: #ffffff;
			color: #056de8;
			margin-top: -10px;
		}
	}
}

.invoiceManage {
	display: flex;
	justify-content: space-between;

	.ht-base-button {
		margin-top: 10px;
	}
}

/deep/.ht-base-form-item .ivu-select-disabled {
	.ivu-select-selection {
		color: #666666;
	}
}

/deep/.ht-base-input .ivu-input-disabled[disabled],
.ivu-input[disabled] {
	color: #666 !important;
}

.htCartInfoWrap {
	// border: 1px solid #DDDDDD;
	// padding: 20px 18px;
}

.htCartInfoBoxTitle {
	p {
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}

	p::before {
		content: '';
		display: inline-block;
		width: 4px;
		height: 14px;
		color: #056de8;
		background: #056de8;
		margin-right: 8px;
	}
}

.ht-layout-skyBlue .htCartInfoWrap .htCartInfoBox {
	border-top: 1px dashed #d2d4db;
}

.ht-layout-skyBlue .htCartInfoWrap .htCartInfoBox .htCartInfoBoxTitle {
	font-weight: bold !important;
	font-size: 15px;
}

.ht-layout-skyBlue .htCartInfoWrap .htCartInfoBox .htCartInfoBoxSubTitle {
	font-weight: bold !important;
}

.title-icon {
	display: flex;
	justify-content: space-between;
	align-items: center;

	p {
		width: 200px;
	}

	div {
		width: 120px;
		height: 30px;
		line-height: 30px;
		background-color: rgba(5, 109, 232, 1);
		color: rgba(255, 255, 255, 1);
		font-size: 14px;
		text-align: center;
		font-weight: normal;
		display: flex;
		justify-content: center;
		align-items: center;
	}
}

.ht-radio {
	/deep/.ht-base-radio-group.ivu-radio-group-border-select:first-child
		.ivu-radio-wrapper-checked {
		background: #056de8;
		color: rgba(255, 255, 255, 1);
	}
}

/deep/.ht-base-radio-group.ivu-radio-group-border-select .ivu-radio-wrapper-checked:before {
	border-bottom: 13px solid #056de8;
}

/deep/.ht-base-radio-group.ivu-radio-group-border-select:first-child .ivu-radio-wrapper-checked {
	border-color: #056de8;
}

.htContactAdress {
	float: left;
	text-align: center;
	width: 130px;
	height: 30px;
	line-height: 26px;
	position: relative;
	border: 2px solid #cccccc;
}

.ht-adress {
	border: 2px solid rgba(5, 109, 232, 1);

	span {
		width: 0;
		height: 0;
		border-bottom: 12px solid rgba(5, 109, 232, 1);
		border-left: 12px solid transparent;
		position: absolute;
		bottom: 0;
		right: 0;
	}

	img {
		width: 5px;
		height: 5px;
		position: absolute;
		bottom: 0;
		right: 0;
	}
}

.cc-item {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	margin-bottom: 10px !important;

	/deep/.ivu-form-item-label {
		width: 15%;
		text-align: left;
		color: #666666;
	}

	/deep/.ivu-form-item-content {
		width: 60%;
	}

	/deep/.ivu-input.ivu-input-default {
		border: none !important;
		background-color: #f7f7f7 !important;
		color: #333333 !important;
	}
}

.ht-layout-skyBlue {
	/deep/.ivu-modal {
		height: 755px;
		overflow-y: hidden;
	}

	/deep/.ivu-modal-body {
		height: 700px;
		overflow-y: scroll;
	}

	/deep/.v-transfer-dom .ivu-modal .ivu-modal-content {
		border-radius: 0 !important;
	}

	/deep/.ivu-modal-footer {
		position: absolute;
		width: 100%;
		height: 75px;
		background: #ffffff;
		bottom: 0px;
		left: 0;

		div {
			transform: translateY(20%);
		}
	}
}

.c-model {
	/deep/.ivu-btn-primary {
		background: #df0112 !important;
	}

	/deep/.ivu-btn {
		padding: 0 75px;
		height: 40px !important;
		line-height: 40px !important;
	}
}

/deep/.ht-base-radio-group.ivu-radio-group-border-select .ivu-radio-group-item {
	border-radius: 0 !important;
}

/deep/.ht-base-radio-group.ivu-radio-group-border-select .ivu-radio-group-item {
	border-width: 2px !important;
	line-height: 30px !important;
}

.htContactName {
	min-width: 60px;
	width: auto !important;
	max-width: 100px;
	overflow: visible;
	display: flex !important;
	justify-content: flex-start;
	flex-wrap: nowrap;
	// white-space: pre-line !important;
}

.htContactAddress {
	width: 490px !important;
	overflow: visible;
	display: flex !important;
	justify-content: flex-start;
	flex-wrap: nowrap;
	line-height: 26px !important;
}

.htContactMobiles {
	width: 170px !important;
	overflow: visible;
	display: flex !important;
	justify-content: flex-start;
	flex-wrap: nowrap;
	white-space: pre-line !important;
}

.d-table {
	font-size: 14px;
	color: #333333;
	margin: 20px 8px 8px 0;
	font-weight: bold;
}

.d-table::before {
	content: '';
	display: inline-block;
	width: 4px;
	height: 14px;
	color: #056de8;
	background: #056de8;
	margin-right: 8px;
}

.disa {
	color: #056de8;

	/deep/.ivu-form-item-label {
		color: #056de8;
	}

	/deep/.ivu-input-disabled {
		color: #056de8;
	}
}

/deep/.el-cascader {
	width: 100%;
}

/deep/.el-dialog__header {
	border-bottom: 1px solid #e4e4e4;
}

/deep/.el-dialog__title {
	font-weight: bold;
}

/deep/.el-dialog__body {
	border-bottom: 1px solid #e4e4e4;
}

/deep/.el-dialog {
	border-radius: 6px !important;
}
.ht-li-address {
	font-weight: bold;

	.htContactName {
		color: #056de8 !important;
		white-space: nowrap !important;
	}
	.htContactMobile {
		color: #056de8 !important;
	}
	.htContactAddress {
		color: #056de8 !important;
	}
	.htContactMobiles {
		color: #056de8 !important;
	}
}
/deep/.ivu-form-item {
	margin-bottom: 10px !important;
}
</style>
